aboutsummaryrefslogtreecommitdiff
path: root/node_modules/sha.js/test/test.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/sha.js/test/test.js')
-rw-r--r--node_modules/sha.js/test/test.js19
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()
+})