Commit 441d57ee790defbd1617fdf35f4025a4450be80c
encode strings the future proof (but wrong) way
Dominic Tarr committed on 3/26/2016, 7:20:12 AMParent: 94ad29364a5682156f86894505f5e7118f39589b
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -27,9 +27,14 @@ | ||
27 | 27 | return _obj |
28 | 28 | } |
29 | 29 | |
30 | 30 | function hash (data, enc) { |
31 | - return crypto.createHash('sha256').update(data,enc).digest('base64')+'.sha256' | |
31 | + data = ( | |
32 | + 'string' === typeof data && enc == null | |
33 | + ? new Buffer(data, 'binary') | |
34 | + : new Buffer(data, enc) | |
35 | + ) | |
36 | + return crypto.createHash('sha256').update(data).digest('base64')+'.sha256' | |
32 | 37 | } |
33 | 38 | |
34 | 39 | var isLink = ssbref.isLink |
35 | 40 | var isFeedId = ssbref.isFeedId |
Built with git-ssb-web