X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FSha256.java;h=011cd86130d5d3dd1c804eda24a1415c60c5d489;hb=f3e670e9341decac613d33fc52febf19cea32f20;hp=76c110a7372691e2cf37777bdd9c8900dc4a99fc;hpb=db1a11032b4164540a2d3403696be12bbca70e94;p=ldk-java diff --git a/src/main/java/org/ldk/structs/Sha256.java b/src/main/java/org/ldk/structs/Sha256.java index 76c110a7..011cd861 100644 --- a/src/main/java/org/ldk/structs/Sha256.java +++ b/src/main/java/org/ldk/structs/Sha256.java @@ -19,14 +19,8 @@ public class Sha256 extends CommonBase { if (ptr != 0) { bindings.Sha256_free(ptr); } } - /** - * Checks if two Sha256s contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. - */ - public boolean eq(Sha256 b) { - boolean ret = bindings.Sha256_eq(this.ptr, b == null ? 0 : b.ptr & ~1); - this.ptrs_to.add(b); + long clone_ptr() { + long ret = bindings.Sha256_clone_ptr(this.ptr); return ret; } @@ -35,10 +29,29 @@ public class Sha256 extends CommonBase { */ public Sha256 clone() { long ret = bindings.Sha256_clone(this.ptr); - if (ret < 1024) { return null; } - Sha256 ret_hu_conv = new Sha256(null, ret); + if (ret >= 0 && ret <= 4096) { return null; } + Sha256 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Sha256(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } + /** + * Checks if two Sha256s contain equal inner contents. + */ + public long hash() { + long ret = bindings.Sha256_hash(this.ptr); + return ret; + } + + /** + * Checks if two Sha256s contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. + */ + public boolean eq(Sha256 b) { + boolean ret = bindings.Sha256_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + this.ptrs_to.add(b); + return ret; + } + }