@@ -10,6 +10,18 @@ var ECPubKey = require('..').ECPubKey
1010var Message = require ( '..' ) . Message
1111
1212describe ( 'ecdsa' , function ( ) {
13+ // FIXME: needs much better tests than this
14+ describe ( 'deterministicGenerateK' , function ( ) {
15+ it ( 'produces deterministic K values' , function ( ) {
16+ var secret = [ 4 ]
17+
18+ var k1 = ecdsa . deterministicGenerateK ( [ 1 ] , secret )
19+ var k2 = ecdsa . deterministicGenerateK ( [ 2 ] , secret )
20+
21+ assert . notDeepEqual ( k1 , k2 )
22+ } )
23+ } )
24+
1325 describe ( 'recoverPubKey' , function ( ) {
1426 it ( 'succesfully recovers a public key' , function ( ) {
1527 var addr = 'mgQK8S6CfSXKjPmnujArSmVxafeJfrZsa3'
@@ -24,7 +36,7 @@ describe('ecdsa', function() {
2436 describe ( 'sign/verify' , function ( ) {
2537 it ( 'Signing and Verifying' , function ( ) {
2638 var s1 = ECKey . makeRandom ( )
27- var sig_a = s1 . sign ( BigInteger . ZERO )
39+ var sig_a = s1 . sign ( [ 0 ] )
2840
2941 assert . ok ( sig_a , 'Sign null' )
3042 assert . ok ( s1 . pub . verify ( BigInteger . ZERO , sig_a ) )
@@ -59,7 +71,7 @@ describe('ecdsa', function() {
5971
6072 it ( 'should sign with low S value' , function ( ) {
6173 var priv = ECKey . fromHex ( 'ca48ec9783cf3ad0dfeff1fc254395a2e403cbbc666477b61b45e31d3b8ab458' )
62- var message = 'Vires in numeris'
74+ var message = new Buffer ( 'Vires in numeris' )
6375 var signature = priv . sign ( message )
6476 var parsed = ecdsa . parseSig ( signature )
6577
0 commit comments