git ssb

1+

Dominic / ssb-keys



Commit d8e28e38a387d460308701a089afb9674986874c

put hash in the sign methods, more consistent with sodium

Dominic Tarr committed on 7/5/2015, 1:27:30 AM
Parent: 3960a137f68a96eca62ddb1394b60381b459c4a6

Files changed

eccjs.jschanged
eccjs.jsView
@@ -1,11 +1,16 @@
11
22
33 var ecc = require('eccjs')
44 var crypto = require('crypto')
5+var Blake2s = require('blake2s')
56
67 var curve = ecc.curves.k256
78
9+function hash (message) {
10+ return new Blake2s().update(message).digest()
11+}
12+
813 module.exports = {
914
1015 curves: ['k256'],
1116
@@ -24,13 +29,13 @@
2429 }
2530 },
2631
2732 sign: function (private, message) {
28- return ecc.sign(curve, private, message)
33+ return ecc.sign(curve, private, hash(message))
2934 },
3035
3136 verify: function (public, sig, message) {
32- return ecc.verify(curve, public, sig, message)
37+ return ecc.verify(curve, public, sig, hash(message))
3338 },
3439
3540 restore: function (seed) {
3641 return ecc.restore(curve, seed)

Built with git-ssb-web