From 6c91f2520f524c345a08494a6d976008f5aa1ad1 Mon Sep 17 00:00:00 2001 From: Alden Torres Date: Fri, 19 Feb 2016 09:42:05 -0500 Subject: [PATCH] Improved Sha1Hash API --- .../jlibtorrent/AddTorrentParams.java | 2 +- .../com/frostwire/jlibtorrent/Session.java | 10 +- .../com/frostwire/jlibtorrent/Sha1Hash.java | 21 ++- .../jlibtorrent/swig/libtorrent_jni.java | 5 +- .../frostwire/jlibtorrent/swig/sha1_hash.java | 14 +- swig/libtorrent.i | 18 ++ swig/libtorrent_jni.cpp | 94 ++++++++++- swig/libtorrent_node.cpp | 159 +++++++++++++++++- 8 files changed, 306 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/frostwire/jlibtorrent/AddTorrentParams.java b/src/main/java/com/frostwire/jlibtorrent/AddTorrentParams.java index cf35ab34f..9b2388ca2 100644 --- a/src/main/java/com/frostwire/jlibtorrent/AddTorrentParams.java +++ b/src/main/java/com/frostwire/jlibtorrent/AddTorrentParams.java @@ -278,7 +278,7 @@ public Sha1Hash infoHash() { * @param value */ public void infoHash(Sha1Hash value) { - p.setInfo_hash(value.getSwig()); + p.setInfo_hash(value.swig()); } /* diff --git a/src/main/java/com/frostwire/jlibtorrent/Session.java b/src/main/java/com/frostwire/jlibtorrent/Session.java index f0416f504..377811db5 100644 --- a/src/main/java/com/frostwire/jlibtorrent/Session.java +++ b/src/main/java/com/frostwire/jlibtorrent/Session.java @@ -504,7 +504,7 @@ public void postDHTStats() { * @return */ public TorrentHandle findTorrent(Sha1Hash infoHash) { - torrent_handle th = s.find_torrent(infoHash.getSwig()); + torrent_handle th = s.find_torrent(infoHash.swig()); return th != null && th.is_valid() ? new TorrentHandle(th) : null; } @@ -609,7 +609,7 @@ public void addDHTRouter(Pair node) { * @param target */ public void dhtGetItem(Sha1Hash target) { - s.dht_get_item(target.getSwig()); + s.dht_get_item(target.swig()); } /** @@ -687,15 +687,15 @@ public void dhtPutItem(byte[] publicKey, byte[] privateKey, Entry entry, byte[] } public void dhtGetPeers(Sha1Hash infoHash) { - s.dht_get_peers(infoHash.getSwig()); + s.dht_get_peers(infoHash.swig()); } public void dhtAnnounce(Sha1Hash infoHash, int port, int flags) { - s.dht_announce(infoHash.getSwig(), port, flags); + s.dht_announce(infoHash.swig(), port, flags); } public void dhtAnnounce(Sha1Hash infoHash) { - s.dht_announce(infoHash.getSwig()); + s.dht_announce(infoHash.swig()); } public void dhtDirectRequest(UdpEndpoint endp, Entry entry) { diff --git a/src/main/java/com/frostwire/jlibtorrent/Sha1Hash.java b/src/main/java/com/frostwire/jlibtorrent/Sha1Hash.java index fe3b4643b..3b8ffe53d 100644 --- a/src/main/java/com/frostwire/jlibtorrent/Sha1Hash.java +++ b/src/main/java/com/frostwire/jlibtorrent/Sha1Hash.java @@ -21,6 +21,14 @@ public Sha1Hash(sha1_hash h) { this.h = h; } + public Sha1Hash(byte[] bytes) { + if (bytes.length != 20) { + throw new IllegalArgumentException("bytes array must be of length 20"); + } + + this.h = new sha1_hash(Vectors.bytes2byte_vector(bytes)); + } + public Sha1Hash(String hex) { this(); if (!sha1_hash.from_hex(hex, h)) { @@ -29,13 +37,13 @@ public Sha1Hash(String hex) { } /** - * Constructs an all-sero sha1-hash + * Constructs an all-zero sha1-hash */ public Sha1Hash() { this(new sha1_hash()); } - public sha1_hash getSwig() { + public sha1_hash swig() { return h; } @@ -55,6 +63,10 @@ public boolean isAllZeros() { return h.is_all_zeros(); } + public byte[] toBytes() { + return Vectors.byte_vector2bytes(h.to_bytes()); + } + /** * Returns the hex representation of this has. *

@@ -86,6 +98,11 @@ public boolean equals(Object obj) { return h.op_eq(((Sha1Hash) obj).h); } + @Override + public int hashCode() { + return h.hash_code(); + } + /** * returns an all-F sha1-hash. i.e. the maximum value * representable by a 160 bit number (20 bytes). This is diff --git a/src/main/java/com/frostwire/jlibtorrent/swig/libtorrent_jni.java b/src/main/java/com/frostwire/jlibtorrent/swig/libtorrent_jni.java index ee0986f1f..76d40a427 100644 --- a/src/main/java/com/frostwire/jlibtorrent/swig/libtorrent_jni.java +++ b/src/main/java/com/frostwire/jlibtorrent/swig/libtorrent_jni.java @@ -605,7 +605,7 @@ public class libtorrent_jni { public final static native long entry_bencode(long jarg1, entry jarg1_); public final static native long entry_bdecode(long jarg1, byte_vector jarg1_); public final static native int sha1_hash_size_get(); - public final static native long new_sha1_hash(); + public final static native long new_sha1_hash__SWIG_0(); public final static native long sha1_hash_max(); public final static native long sha1_hash_min(); public final static native void sha1_hash_clear(long jarg1, sha1_hash jarg1_); @@ -613,6 +613,9 @@ public class libtorrent_jni { public final static native boolean sha1_hash_op_eq(long jarg1, sha1_hash jarg1_, long jarg2, sha1_hash jarg2_); public final static native boolean sha1_hash_op_neq(long jarg1, sha1_hash jarg1_, long jarg2, sha1_hash jarg2_); public final static native boolean sha1_hash_op_lt(long jarg1, sha1_hash jarg1_, long jarg2, sha1_hash jarg2_); + public final static native long new_sha1_hash__SWIG_1(long jarg1, byte_vector jarg1_); + public final static native int sha1_hash_hash_code(long jarg1, sha1_hash jarg1_); + public final static native long sha1_hash_to_bytes(long jarg1, sha1_hash jarg1_); public final static native String sha1_hash_to_hex(long jarg1, sha1_hash jarg1_); public final static native boolean sha1_hash_from_hex(String jarg1, long jarg2, sha1_hash jarg2_); public final static native int sha1_hash_compare(long jarg1, sha1_hash jarg1_, long jarg2, sha1_hash jarg2_); diff --git a/src/main/java/com/frostwire/jlibtorrent/swig/sha1_hash.java b/src/main/java/com/frostwire/jlibtorrent/swig/sha1_hash.java index 9b511c7ef..abf9b0c7b 100644 --- a/src/main/java/com/frostwire/jlibtorrent/swig/sha1_hash.java +++ b/src/main/java/com/frostwire/jlibtorrent/swig/sha1_hash.java @@ -36,7 +36,7 @@ public synchronized void delete() { } public sha1_hash() { - this(libtorrent_jni.new_sha1_hash(), true); + this(libtorrent_jni.new_sha1_hash__SWIG_0(), true); } public static sha1_hash max() { @@ -67,6 +67,18 @@ public boolean op_lt(sha1_hash n) { return libtorrent_jni.sha1_hash_op_lt(swigCPtr, this, sha1_hash.getCPtr(n), n); } + public sha1_hash(byte_vector s) { + this(libtorrent_jni.new_sha1_hash__SWIG_1(byte_vector.getCPtr(s), s), true); + } + + public int hash_code() { + return libtorrent_jni.sha1_hash_hash_code(swigCPtr, this); + } + + public byte_vector to_bytes() { + return new byte_vector(libtorrent_jni.sha1_hash_to_bytes(swigCPtr, this), true); + } + public String to_hex() { return libtorrent_jni.sha1_hash_to_hex(swigCPtr, this); } diff --git a/swig/libtorrent.i b/swig/libtorrent.i index 2dc92920c..08f93dbee 100644 --- a/swig/libtorrent.i +++ b/swig/libtorrent.i @@ -1013,6 +1013,24 @@ namespace libtorrent { }; %extend sha1_hash { + sha1_hash(std::vector const& s) { + return new sha1_hash(std::string(s.begin(), s.end())); + } + + int hash_code() { + char const* data = $self->data(); + int result = 1; + for (int i = 0; i < 20; i++) { + result = 31 * result + data[i]; + } + return result; + } + + std::vector to_bytes() { + std::string s = $self->to_string(); + return std::vector(s.begin(), s.end()); + } + std::string to_hex() { return libtorrent::to_hex($self->to_string()); } diff --git a/swig/libtorrent_jni.cpp b/swig/libtorrent_jni.cpp index 945756eab..3e69a2f65 100644 --- a/swig/libtorrent_jni.cpp +++ b/swig/libtorrent_jni.cpp @@ -1253,6 +1253,21 @@ SWIGINTERN std::vector< int8_t > libtorrent_entry_bencode(libtorrent::entry *sel SWIGINTERN libtorrent::entry libtorrent_entry_bdecode(std::vector< int8_t > &buffer){ return libtorrent::bdecode(buffer.begin(), buffer.end()); } +SWIGINTERN libtorrent::sha1_hash *new_libtorrent_sha1_hash__SWIG_1(std::vector< int8_t > const &s){ + return new sha1_hash(std::string(s.begin(), s.end())); + } +SWIGINTERN int libtorrent_sha1_hash_hash_code(libtorrent::sha1_hash *self){ + char const* data = self->data(); + int result = 1; + for (int i = 0; i < 20; i++) { + result = 31 * result + data[i]; + } + return result; + } +SWIGINTERN std::vector< int8_t > libtorrent_sha1_hash_to_bytes(libtorrent::sha1_hash *self){ + std::string s = self->to_string(); + return std::vector(s.begin(), s.end()); + } SWIGINTERN std::string libtorrent_sha1_hash_to_hex(libtorrent::sha1_hash *self){ return libtorrent::to_hex(self->to_string()); } @@ -17630,7 +17645,7 @@ SWIGEXPORT jint JNICALL Java_com_frostwire_jlibtorrent_swig_libtorrent_1jni_sha1 } -SWIGEXPORT jlong JNICALL Java_com_frostwire_jlibtorrent_swig_libtorrent_1jni_new_1sha1_1hash(JNIEnv *jenv, jclass jcls) { +SWIGEXPORT jlong JNICALL Java_com_frostwire_jlibtorrent_swig_libtorrent_1jni_new_1sha1_1hash_1_1SWIG_10(JNIEnv *jenv, jclass jcls) { jlong jresult = 0 ; libtorrent::sha1_hash *result = 0 ; @@ -17822,6 +17837,79 @@ SWIGEXPORT jboolean JNICALL Java_com_frostwire_jlibtorrent_swig_libtorrent_1jni_ } +SWIGEXPORT jlong JNICALL Java_com_frostwire_jlibtorrent_swig_libtorrent_1jni_new_1sha1_1hash_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + std::vector< int8_t > *arg1 = 0 ; + libtorrent::sha1_hash *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< int8_t > **)&jarg1; + if (!arg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< int8_t > const & reference is null"); + return 0; + } + { + try { + result = (libtorrent::sha1_hash *)new_libtorrent_sha1_hash__SWIG_1((std::vector< signed char > const &)*arg1); + } catch (std::exception& e) { + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what()); + } catch (...) { + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception type"); + } + } + *(libtorrent::sha1_hash **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_com_frostwire_jlibtorrent_swig_libtorrent_1jni_sha1_1hash_1hash_1code(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + libtorrent::sha1_hash *arg1 = (libtorrent::sha1_hash *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(libtorrent::sha1_hash **)&jarg1; + { + try { + result = (int)libtorrent_sha1_hash_hash_code(arg1); + } catch (std::exception& e) { + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what()); + } catch (...) { + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception type"); + } + } + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_com_frostwire_jlibtorrent_swig_libtorrent_1jni_sha1_1hash_1to_1bytes(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + libtorrent::sha1_hash *arg1 = (libtorrent::sha1_hash *) 0 ; + std::vector< int8_t > result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(libtorrent::sha1_hash **)&jarg1; + { + try { + result = libtorrent_sha1_hash_to_bytes(arg1); + } catch (std::exception& e) { + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what()); + } catch (...) { + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception type"); + } + } + *(std::vector< int8_t > **)&jresult = new std::vector< int8_t >((const std::vector< int8_t > &)result); + return jresult; +} + + SWIGEXPORT jstring JNICALL Java_com_frostwire_jlibtorrent_swig_libtorrent_1jni_sha1_1hash_1to_1hex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jstring jresult = 0 ; libtorrent::sha1_hash *arg1 = (libtorrent::sha1_hash *) 0 ; @@ -61658,7 +61746,7 @@ SWIGEXPORT jstring JNICALL Java_com_frostwire_jlibtorrent_swig_libtorrent_1jni_L (void)jenv; (void)jcls; - result = (char *)("d6d0480313985ab311cf7db2a0a9adc1d3f7314c"); + result = (char *)("a675a749e00ef9636d73f334a96e0b3ec34c8fd6"); if (result) jresult = jenv->NewStringUTF((const char *)result); return jresult; } @@ -61670,7 +61758,7 @@ SWIGEXPORT jstring JNICALL Java_com_frostwire_jlibtorrent_swig_libtorrent_1jni_J (void)jenv; (void)jcls; - result = (char *)("6b1334d1696c70269cb8d81782e4e3d8506efc1f"); + result = (char *)("c49a9f5f50156e2859f6797df6c488994077a0b6"); if (result) jresult = jenv->NewStringUTF((const char *)result); return jresult; } diff --git a/swig/libtorrent_node.cpp b/swig/libtorrent_node.cpp index 0afa92f1b..c5c3b3325 100644 --- a/swig/libtorrent_node.cpp +++ b/swig/libtorrent_node.cpp @@ -2663,6 +2663,21 @@ SWIGINTERN std::vector< int8_t > libtorrent_entry_bencode(libtorrent::entry *sel SWIGINTERN libtorrent::entry libtorrent_entry_bdecode(std::vector< int8_t > &buffer){ return libtorrent::bdecode(buffer.begin(), buffer.end()); } +SWIGINTERN libtorrent::sha1_hash *new_libtorrent_sha1_hash__SWIG_1(std::vector< int8_t > const &s){ + return new sha1_hash(std::string(s.begin(), s.end())); + } +SWIGINTERN int libtorrent_sha1_hash_hash_code(libtorrent::sha1_hash *self){ + char const* data = self->data(); + int result = 1; + for (int i = 0; i < 20; i++) { + result = 31 * result + data[i]; + } + return result; + } +SWIGINTERN std::vector< int8_t > libtorrent_sha1_hash_to_bytes(libtorrent::sha1_hash *self){ + std::string s = self->to_string(); + return std::vector(s.begin(), s.end()); + } SWIGINTERN std::string libtorrent_sha1_hash_to_hex(libtorrent::sha1_hash *self){ return libtorrent::to_hex(self->to_string()); } @@ -23939,12 +23954,12 @@ static SwigV8ReturnValue _wrap_libtorrent_sha1_hash_size(v8::Local p } -static SwigV8ReturnValue _wrap_new_sha1_hash(const SwigV8Arguments &args) { +static SwigV8ReturnValue _wrap_new_sha1_hash__SWIG_0(const SwigV8Arguments &args, V8ErrorHandler &SWIGV8_ErrorHandler) { SWIGV8_HANDLESCOPE(); v8::Handle self = args.Holder(); libtorrent::sha1_hash *result; - if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_new_sha1_hash."); + if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_new_sha1_hash__SWIG_0."); result = (libtorrent::sha1_hash *)new libtorrent::sha1_hash(); @@ -24171,6 +24186,140 @@ static SwigV8ReturnValue _wrap_sha1_hash_op_lt(const SwigV8Arguments &args) { } +static SwigV8ReturnValue _wrap_new_sha1_hash__SWIG_1(const SwigV8Arguments &args, V8ErrorHandler &SWIGV8_ErrorHandler) { + SWIGV8_HANDLESCOPE(); + + v8::Handle self = args.Holder(); + std::vector< int8_t > *arg1 = 0 ; + void *argp1 ; + int res1 = 0 ; + libtorrent::sha1_hash *result; + if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_new_sha1_hash__SWIG_1."); + res1 = SWIG_ConvertPtr(args[0], &argp1, SWIGTYPE_p_std__vectorT_signed_char_t, 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_sha1_hash" "', argument " "1"" of type '" "std::vector< int8_t > const &""'"); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_sha1_hash" "', argument " "1"" of type '" "std::vector< int8_t > const &""'"); + } + arg1 = (std::vector< int8_t > *)(argp1); + result = (libtorrent::sha1_hash *)new_libtorrent_sha1_hash__SWIG_1((std::vector< signed char > const &)*arg1); + + + + + SWIGV8_SetPrivateData(self, result, SWIGTYPE_p_libtorrent__sha1_hash, SWIG_POINTER_OWN); + SWIGV8_RETURN(self); + + goto fail; +fail: + SWIGV8_RETURN(SWIGV8_UNDEFINED()); +} + + +static SwigV8ReturnValue _wrap_new_sha1_hash(const SwigV8Arguments &args) { + SWIGV8_HANDLESCOPE(); + + OverloadErrorHandler errorHandler; + v8::Handle self; + + // switch all cases by means of series of if-returns. + + if(args.Length() == 0) { + errorHandler.err.Clear(); +#if (SWIG_V8_VERSION < 0x031903) + self = _wrap_new_sha1_hash__SWIG_0(args, errorHandler); + if(errorHandler.err.IsEmpty()) { + SWIGV8_ESCAPE(self); + } +#else + _wrap_new_sha1_hash__SWIG_0(args, errorHandler); + if(errorHandler.err.IsEmpty()) { + return; + } +#endif + } + + if(args.Length() == 1) { + errorHandler.err.Clear(); +#if (SWIG_V8_VERSION < 0x031903) + self = _wrap_new_sha1_hash__SWIG_1(args, errorHandler); + if(errorHandler.err.IsEmpty()) { + SWIGV8_ESCAPE(self); + } +#else + _wrap_new_sha1_hash__SWIG_1(args, errorHandler); + if(errorHandler.err.IsEmpty()) { + return; + } +#endif + } + + + // default: + SWIG_exception_fail(SWIG_ERROR, "Illegal arguments for construction of _exports_sha1_hash"); + +fail: + SWIGV8_RETURN(SWIGV8_UNDEFINED()); +} + + +static SwigV8ReturnValue _wrap_sha1_hash_hash_code(const SwigV8Arguments &args) { + SWIGV8_HANDLESCOPE(); + + v8::Handle jsresult; + libtorrent::sha1_hash *arg1 = (libtorrent::sha1_hash *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + + if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_sha1_hash_hash_code."); + + res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_libtorrent__sha1_hash, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sha1_hash_hash_code" "', argument " "1"" of type '" "libtorrent::sha1_hash *""'"); + } + arg1 = (libtorrent::sha1_hash *)(argp1); + result = (int)libtorrent_sha1_hash_hash_code(arg1); + jsresult = SWIG_From_int((int)(result)); + + + SWIGV8_RETURN(jsresult); + + goto fail; +fail: + SWIGV8_RETURN(SWIGV8_UNDEFINED()); +} + + +static SwigV8ReturnValue _wrap_sha1_hash_to_bytes(const SwigV8Arguments &args) { + SWIGV8_HANDLESCOPE(); + + v8::Handle jsresult; + libtorrent::sha1_hash *arg1 = (libtorrent::sha1_hash *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< int8_t > result; + + if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_sha1_hash_to_bytes."); + + res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_libtorrent__sha1_hash, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sha1_hash_to_bytes" "', argument " "1"" of type '" "libtorrent::sha1_hash *""'"); + } + arg1 = (libtorrent::sha1_hash *)(argp1); + result = libtorrent_sha1_hash_to_bytes(arg1); + jsresult = SWIG_NewPointerObj((new std::vector< int8_t >((const std::vector< int8_t >&)(result))), SWIGTYPE_p_std__vectorT_signed_char_t, SWIG_POINTER_OWN | 0 ); + + + SWIGV8_RETURN(jsresult); + + goto fail; +fail: + SWIGV8_RETURN(SWIGV8_UNDEFINED()); +} + + static SwigV8ReturnValue _wrap_sha1_hash_to_hex(const SwigV8Arguments &args) { SWIGV8_HANDLESCOPE(); @@ -103798,7 +103947,7 @@ static SwigV8ReturnValue _wrap_LIBTORRENT_REVISION_SHA1(v8::Local pr v8::Handle jsresult; - jsresult = SWIG_FromCharPtr((const char *)"d6d0480313985ab311cf7db2a0a9adc1d3f7314c"); + jsresult = SWIG_FromCharPtr((const char *)"a675a749e00ef9636d73f334a96e0b3ec34c8fd6"); SWIGV8_RETURN_INFO(jsresult, info); @@ -103813,7 +103962,7 @@ static SwigV8ReturnValue _wrap_JLIBTORRENT_REVISION_SHA1(v8::Local p v8::Handle jsresult; - jsresult = SWIG_FromCharPtr((const char *)"6b1334d1696c70269cb8d81782e4e3d8506efc1f"); + jsresult = SWIG_FromCharPtr((const char *)"c49a9f5f50156e2859f6797df6c488994077a0b6"); SWIGV8_RETURN_INFO(jsresult, info); @@ -113254,6 +113403,8 @@ SWIGV8_AddMemberFunction(_exports_sha1_hash_class, "is_all_zeros", _wrap_sha1_ha SWIGV8_AddMemberFunction(_exports_sha1_hash_class, "op_eq", _wrap_sha1_hash_op_eq); SWIGV8_AddMemberFunction(_exports_sha1_hash_class, "op_neq", _wrap_sha1_hash_op_neq); SWIGV8_AddMemberFunction(_exports_sha1_hash_class, "op_lt", _wrap_sha1_hash_op_lt); +SWIGV8_AddMemberFunction(_exports_sha1_hash_class, "hash_code", _wrap_sha1_hash_hash_code); +SWIGV8_AddMemberFunction(_exports_sha1_hash_class, "to_bytes", _wrap_sha1_hash_to_bytes); SWIGV8_AddMemberFunction(_exports_sha1_hash_class, "to_hex", _wrap_sha1_hash_to_hex); SWIGV8_AddStaticVariable(exports_obj, "storage_mode_allocate", _wrap_libtorrent_storage_mode_allocate, JS_veto_set_variable); SWIGV8_AddStaticVariable(exports_obj, "storage_mode_sparse", _wrap_libtorrent_storage_mode_sparse, JS_veto_set_variable);