add SHA-1 implementation

This commit is contained in:
Quinn Slack
2011-04-19 01:12:47 -07:00
parent ac441e835e
commit 080df573cb
3 changed files with 695 additions and 0 deletions

14
test/sha1_test.js Normal file
View File

@@ -0,0 +1,14 @@
new sjcl.test.TestCase("SHA-1 from sha1sum", function (cb) {
if (!sjcl.hash.sha1) {
this.unimplemented();
cb && cb();
return;
}
var i, kat=sjcl.test.vector.sha1, p=0, f=0;
for (i=0; i<kat.length; i++) {
var out = sjcl.hash.sha1.hash(kat[i][0]);
this.require(sjcl.codec.hex.fromBits(out) == kat[i][1], i);
}
cb && cb();
});