[Pkg-javascript-commits] [node-sha.js] 124/237: check for streaming updates
Bastien Roucariès
rouca at moszumanska.debian.org
Fri May 5 09:03:46 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-sha.js.
commit 4fc22d239c87d62155292ed7ccef2e36819bd7a6
Author: Dominic Tarr <dominic.tarr at gmail.com>
Date: Tue Jul 22 18:02:26 2014 -0700
check for streaming updates
---
test/vectors.js | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/test/vectors.js b/test/vectors.js
index 6feee20..52b92b6 100644
--- a/test/vectors.js
+++ b/test/vectors.js
@@ -9,7 +9,7 @@ var createHash = require('../')
function makeTest(alg, i, verbose) {
var v = vectors[i]
-
+
tape(alg + ': NIST vector ' + i, function (t) {
if(verbose) {
console.log(v)
@@ -20,6 +20,22 @@ function makeTest(alg, i, verbose) {
}
var buf = new Buffer(v.input, 'base64')
t.equal(createHash(alg).update(buf).digest('hex'), v[alg])
+
+ var i = ~~(buf.length / 2)
+ var buf1 = buf.slice(0, i)
+ var buf2 = buf.slice(i, buf.length)
+
+ console.log(buf1.length, buf2.length, buf.length)
+ console.log(createHash(alg)._block.length)
+
+ t.equal(
+ createHash(alg)
+ .update(buf1)
+ .update(buf2)
+ .digest('hex'),
+ v[alg]
+ )
+
setTimeout(function () {
//avoid "too much recursion" errors in tape in firefox
t.end()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-sha.js.git
More information about the Pkg-javascript-commits
mailing list