fixed bugs, added more tests
This commit is contained in:
1 parent
5a8274a7ef
commit
a1ff5b27bb
3 files changed
+32
-2
No files matched your search
@@ -43,6 +43,33 @@ describe('the hash function', function(){
|
||||
var expt = [2,143,162,180,139,147,74,24,98,184,105,16,81,58,71,103,124,28,45,149,236,62,117,112,120,111,28,50,139,189,74,71];
|
||||
assert.deepEqual(spritz.hash(M, r), expt);
|
||||
});
|
||||
|
||||
it('should be able to hash into big outputs', function(){
|
||||
var M = 'key';
|
||||
var r = 128;
|
||||
var expt = [161,146,113,209,92,234,84,76,1,178];
|
||||
assert.deepEqual(spritz.hash(M, r).splice(0, 10), expt);
|
||||
|
||||
r = 196;
|
||||
expt = [70,186,211,241,183,79,116,6,36,178,244,78,18,13,72,203,248,160,165,201,59];
|
||||
assert.deepEqual(spritz.hash(M, r).splice(0, expt.length), expt);
|
||||
|
||||
|
||||
});
|
||||
|
||||
it('should be able to hash a big chunck of text', function(){
|
||||
var message = "";
|
||||
for(var i = 0; i < 1000; i++){
|
||||
message += "key";
|
||||
}
|
||||
r = 196;
|
||||
expt = [53,4,194,202,251,2,132,3,208,1,176,128,17,208,30,26,47,86,68,211,170];
|
||||
assert.deepEqual(spritz.hash(message, r).splice(0, expt.length), expt);
|
||||
|
||||
r = 255;
|
||||
expt = [148,179,139,174,155,47,98,51,153,231,105,247,132,230,146];
|
||||
assert.deepEqual(spritz.hash(message, r).splice(0, expt.length), expt);
|
||||
});
|
||||
});
|
||||
|
||||
describe('the encrypt/decrypt function', function(){
|
||||
|
||||
Reference in new issue
Block a user