A possible solution for the sha256 signatures verification
This commit is contained in:
parent
01ecc4a4cd
commit
48b2103e21
|
@ -27,7 +27,7 @@ var sha1 = exports.sha1 = platform.sha1;
|
|||
* @return {Buffer} Resulting hash.
|
||||
* @function
|
||||
*/
|
||||
exports.sha256 = platform.sha256;
|
||||
var sha256 = exports.sha256 = platform.sha256;
|
||||
|
||||
/**
|
||||
* Calculate SHA-512 hash.
|
||||
|
@ -91,7 +91,11 @@ exports.sign = function(privateKey, msg) {
|
|||
*/
|
||||
exports.verify = function(publicKey, msg, sig) {
|
||||
var hash = sha1(msg);
|
||||
return eccrypto.verify(publicKey, hash, sig);
|
||||
var result = eccrypto.verify(publicKey, hash, sig).catch(function() {
|
||||
hash = sha256(msg);
|
||||
return eccrypto.verify(publicKey, hash, sig);
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
||||
var SECP256K1_TYPE = 714;
|
||||
|
|
Loading…
Reference in New Issue
Block a user