|
|
|
@ -32,7 +32,8 @@
|
|
|
|
|
|
|
|
|
|
var md4 = function(message) {
|
|
|
|
|
var h0, h1, h2, h3, a, b, c, d, ab, bc, cd, da, code, first = true, end = false,
|
|
|
|
|
index = 0, i, start = 0, bytes = 0, length = message.length;
|
|
|
|
|
index = 0, i, start = 0, bytes = 0, length = message.length,
|
|
|
|
|
array = (ARRAY_BUFFER ? ArrayBuffer.isView(message) : false) || message instanceof Array;
|
|
|
|
|
|
|
|
|
|
blocks[16] = 0;
|
|
|
|
|
do {
|
|
|
|
@ -41,7 +42,12 @@
|
|
|
|
|
blocks[4] = blocks[5] = blocks[6] = blocks[7] =
|
|
|
|
|
blocks[8] = blocks[9] = blocks[10] = blocks[11] =
|
|
|
|
|
blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
|
|
|
|
|
if(ARRAY_BUFFER) {
|
|
|
|
|
if (ARRAY_BUFFER) {
|
|
|
|
|
if (array) {
|
|
|
|
|
for (i = start;index < length && i < 64; ++index) {
|
|
|
|
|
buffer8[i++] = message[index];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
for (i = start;index < length && i < 64; ++index) {
|
|
|
|
|
code = message.charCodeAt(index);
|
|
|
|
|
if (code < 0x80) {
|
|
|
|
@ -61,6 +67,12 @@
|
|
|
|
|
buffer8[i++] = 0x80 | (code & 0x3f);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (array) {
|
|
|
|
|
for (i = start;index < length && i < 64; ++index) {
|
|
|
|
|
blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
for (i = start;index < length && i < 64; ++index) {
|
|
|
|
|
code = message.charCodeAt(index);
|
|
|
|
@ -82,6 +94,7 @@
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bytes += i - start;
|
|
|
|
|
start = i - 64;
|
|
|
|
|
if(index == length) {
|
|
|
|
|