Archived
1
0

make final adjustments to the siphash function

This commit is contained in:
ZiRo 2016-05-18 16:17:41 +02:00
parent 6008c94949
commit 7f445f81fc
2 changed files with 11 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -47,9 +47,15 @@ var SipHash = (function() {
} }
function hash(key, mh, ml) { function hash(v0h, v0l, v1h, v1l, v2h, v2l, v3h, v3l, mh, ml) {
var mi = { h: mh, l: ml } var mi = { h: mh, l: ml };
var k0 = u8to64(key, 0);
var v0 = { h: v0h, l: v0l };
var v1 = { h: v1h, l: v1l };
var v2 = { h: v2h, l: v2l };
var v3 = { h: v3h, l: v3l };
/*var k0 = u8to64(key, 0);
var k1 = u8to64(key, 8); var k1 = u8to64(key, 8);
var v0 = { h: k0.h, l: k0.l }, v2 = k0; var v0 = { h: k0.h, l: k0.l }, v2 = k0;
@ -58,7 +64,7 @@ var SipHash = (function() {
_xor(v0, { h: 0x736f6d65, l: 0x70736575 }); _xor(v0, { h: 0x736f6d65, l: 0x70736575 });
_xor(v1, { h: 0x646f7261, l: 0x6e646f6d }); _xor(v1, { h: 0x646f7261, l: 0x6e646f6d });
_xor(v2, { h: 0x6c796765, l: 0x6e657261 }); _xor(v2, { h: 0x6c796765, l: 0x6e657261 });
_xor(v3, { h: 0x74656462, l: 0x79746573 }); _xor(v3, { h: 0x74656462, l: 0x79746573 });*/
_xor(v3, mi); _xor(v3, mi);
_compress(v0, v1, v2, v3); _compress(v0, v1, v2, v3);