6 namespace org { namespace ldk { namespace structs {
12 public class Sha256 : CommonBase {
13 internal Sha256(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.Sha256_free(ptr); }
18 internal long clone_ptr() {
19 long ret = bindings.Sha256_clone_ptr(this.ptr);
25 * Creates a copy of the Sha256
27 public Sha256 clone() {
28 long ret = bindings.Sha256_clone(this.ptr);
30 if (ret >= 0 && ret <= 4096) { return null; }
31 org.ldk.structs.Sha256 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Sha256(null, ret); }
32 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
37 * Generates a non-cryptographic 64-bit hash of the Sha256.
40 long ret = bindings.Sha256_hash(this.ptr);
45 public override int GetHashCode() {
46 return (int)this.hash();
49 * Checks if two Sha256s contain equal inner contents.
50 * This ignores pointers and is_owned flags and looks at the values in fields.
51 * Two objects with NULL inner values will be considered "equal" here.
53 public bool eq(org.ldk.structs.Sha256 b) {
54 bool ret = bindings.Sha256_eq(this.ptr, b.ptr);
57 if (this != null) { this.ptrs_to.AddLast(b); };
61 public override bool Equals(object o) {
62 if (!(o is Sha256)) return false;
63 return this.eq((Sha256)o);
66 * Constructs a new [`Sha256`] from the given bytes, which are assumed to be the output of a
69 public static Sha256 from_bytes(byte[] bytes) {
70 long ret = bindings.Sha256_from_bytes(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(bytes, 32)));
72 if (ret >= 0 && ret <= 4096) { return null; }
73 org.ldk.structs.Sha256 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Sha256(null, ret); }
74 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };