Merge pull request #884 from bip32JP/master
Fixed deterministicK() to match python-ecdsa
This commit is contained in:
commit
754add30df
|
@ -100,6 +100,7 @@ ECDSA.prototype.deterministicK = function(badrs) {
|
|||
for (var i = 0; i < badrs || !(T.lt(N) && T.gt(0)); i++) {
|
||||
k = Hash.sha256hmac(Buffer.concat([v, new Buffer([0x00])]), k);
|
||||
v = Hash.sha256hmac(v, k);
|
||||
v = Hash.sha256hmac(v, k);
|
||||
T = BN.fromBuffer(v);
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ describe('ECDSA', function() {
|
|||
ecdsa.k.toBuffer().toString('hex')
|
||||
.should.not.equal('fcce1de7a9bcd6b2d3defade6afa1913fb9229e3b7ddf4749b55c4848b2a196e');
|
||||
ecdsa.k.toBuffer().toString('hex')
|
||||
.should.equal('6f4dcca6fa7a137ae9d110311905013b3c053c732ad18611ec2752bb3dcef9d8');
|
||||
.should.equal('727fbcb59eb48b1d7d46f95a04991fc512eb9dbf9105628e3aec87428df28fd8');
|
||||
});
|
||||
it('should compute this test vector correctly', function() {
|
||||
// test fixture from bitcoinjs
|
||||
|
|
Loading…
Reference in New Issue