diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-12-10 21:51:33 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-12-10 21:51:33 +0100 |
commit | 0469abd4a9c9270a1fdc962969e36e63699af8b4 (patch) | |
tree | f9864d4a4148621378958794cbbfdc2393733283 /node_modules/sha.js/test/test.js | |
parent | 6947e79bbc258f7bc96af424ddb71a511f0c15a3 (diff) |
upgrade dependencies
Diffstat (limited to 'node_modules/sha.js/test/test.js')
-rw-r--r-- | node_modules/sha.js/test/test.js | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/node_modules/sha.js/test/test.js b/node_modules/sha.js/test/test.js index 0a46e44be..623899ddb 100644 --- a/node_modules/sha.js/test/test.js +++ b/node_modules/sha.js/test/test.js @@ -71,8 +71,8 @@ tape('hex encoding', function (t) { for (var i = 0; i < v[0].length; i = (i + 1) * 2) { var s = v[0].substring(i, (i + 1) * 2) - hash.update(new Buffer(s, 'ascii').toString('hex'), 'hex') - _hash.update(new Buffer(s, 'ascii').toString('hex'), 'hex') + hash.update(Buffer.from(s, 'ascii').toString('hex'), 'hex') + _hash.update(Buffer.from(s, 'ascii').toString('hex'), 'hex') } var a = hash.digest('hex') var e = _hash.digest('hex') @@ -83,3 +83,18 @@ tape('hex encoding', function (t) { t.end() }) + +tape('call digest for more than MAX_UINT32 bits of data', function (t) { + var _hash = crypto.createHash('sha1') + var hash = new Sha1() + var bigData = Buffer.alloc(Math.pow(2, 32) / 8) + + hash.update(bigData) + _hash.update(bigData) + + var a = hash.digest('hex') + var e = _hash.digest('hex') + + t.equal(a, e) + t.end() +}) |