(a)
| 7135 | }, |
| 7136 | |
| 7137 | md51_array = function (a) { |
| 7138 | var n = a.length, |
| 7139 | state = [1732584193, -271733879, -1732584194, 271733878], |
| 7140 | i, |
| 7141 | length, |
| 7142 | tail, |
| 7143 | tmp, |
| 7144 | lo, |
| 7145 | hi; |
| 7146 | |
| 7147 | for (i = 64; i <= n; i += 64) { |
| 7148 | md5cycle(state, md5blk_array(a.subarray(i - 64, i))); |
| 7149 | } |
| 7150 | |
| 7151 | // Not sure if it is a bug, however IE10 will always produce a sub array of length 1 |
| 7152 | // containing the last element of the parent array if the sub array specified starts |
| 7153 | // beyond the length of the parent array - weird. |
| 7154 | // https://connect.microsoft.com/IE/feedback/details/771452/typed-array-subarray-issue |
| 7155 | a = (i - 64) < n ? a.subarray(i - 64) : new Uint8Array(0); |
| 7156 | |
| 7157 | length = a.length; |
| 7158 | tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; |
| 7159 | for (i = 0; i < length; i += 1) { |
| 7160 | tail[i >> 2] |= a[i] << ((i % 4) << 3); |
| 7161 | } |
| 7162 | |
| 7163 | tail[i >> 2] |= 0x80 << ((i % 4) << 3); |
| 7164 | if (i > 55) { |
| 7165 | md5cycle(state, tail); |
| 7166 | for (i = 0; i < 16; i += 1) { |
| 7167 | tail[i] = 0; |
| 7168 | } |
| 7169 | } |
| 7170 | |
| 7171 | // Beware that the final length might not fit in 32 bits so we take care of that |
| 7172 | tmp = n * 8; |
| 7173 | tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); |
| 7174 | lo = parseInt(tmp[2], 16); |
| 7175 | hi = parseInt(tmp[1], 16) || 0; |
| 7176 | |
| 7177 | tail[14] = lo; |
| 7178 | tail[15] = hi; |
| 7179 | |
| 7180 | md5cycle(state, tail); |
| 7181 | |
| 7182 | return state; |
| 7183 | }, |
| 7184 | |
| 7185 | hex_chr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'], |
| 7186 |
no test coverage detected