fixed: big-integer 没有 sub 方法,改成 subtract
This commit is contained in:
parent
3145d4864c
commit
ffad2cc8f6
2
index.js
2
index.js
@ -622,7 +622,7 @@ module.exports = {
|
|||||||
distanceSig(hash, sig){ // hash为64hex字符,sig为128hex字符。返回用hex表达的距离。
|
distanceSig(hash, sig){ // hash为64hex字符,sig为128hex字符。返回用hex表达的距离。
|
||||||
if (this.isSignature(sig) && this.isHash(hash)){
|
if (this.isSignature(sig) && this.isHash(hash)){
|
||||||
var hashSig=this.hash(sig) // 把签名也转成32字节的哈希,同样长度方便比较
|
var hashSig=this.hash(sig) // 把签名也转成32字节的哈希,同样长度方便比较
|
||||||
return new BigInt(hash,16).sub(new BigInt(hashSig,16)).abs().toString(16)
|
return new BigInt(hash,16).subtract(new BigInt(hashSig,16)).abs().toString(16)
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user