1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
| class ue { constructor() { this._dataLength = 0, this._bufferLength = 0, this._state = new Int32Array(4), this._buffer = new ArrayBuffer(68), this._buffer8 = new Uint8Array(this._buffer,0,68), this._buffer32 = new Uint32Array(this._buffer,0,17), this.start() } static hashStr(C, _=!1) { return this.onePassHasher.start().appendStr(C).end(_) }
start() { return this._dataLength = 0, this._bufferLength = 0, this._state.set(ue.stateIdentity), this }
appendStr(C) { const _ = this._buffer8 , p = this._buffer32; let g = this._bufferLength, h, v; for (v = 0; v < C.length; v += 1) { if (h = C.charCodeAt(v), h < 128) _[g++] = h; else if (h < 2048) _[g++] = (h >>> 6) + 192, _[g++] = h & 63 | 128; else if (h < 55296 || h > 56319) _[g++] = (h >>> 12) + 224, _[g++] = h >>> 6 & 63 | 128, _[g++] = h & 63 | 128; else { if (h = (h - 55296) * 1024 + (C.charCodeAt(++v) - 56320) + 65536, h > 1114111) console.log("error"); _[g++] = (h >>> 18) + 240, _[g++] = h >>> 12 & 63 | 128, _[g++] = h >>> 6 & 63 | 128, _[g++] = h & 63 | 128 } g >= 64 && (this._dataLength += 64, ue._md5cycle(this._state, p), g -= 64, p[0] = p[16]) } return this._bufferLength = g, this }
end(C=!1) { const _ = this._bufferLength , p = this._buffer8 , g = this._buffer32 , h = (_ >> 2) + 1; this._dataLength += _; const v = this._dataLength * 8; if (p[_] = 128, p[_ + 1] = p[_ + 2] = p[_ + 3] = 0, g.set(ue.buffer32Identity.subarray(h), h), _ > 55 && (ue._md5cycle(this._state, g), g.set(ue.buffer32Identity)), v <= 4294967295) g[14] = v; else { const V = v.toString(16).match(/(.*?)(.{0,8})$/); if (V === null) return; const ie = parseInt(V[2], 16) , we = parseInt(V[1], 16) || 0; g[14] = ie, g[15] = we } return ue._md5cycle(this._state, g), C ? this._state : ue._hex(this._state) } static _md5cycle(C, _) { let p = C[0] , g = C[1] , h = C[2] , v = C[3]; p += (g & h | ~g & v) + _[0] - 680876936 | 0, p = (p << 7 | p >>> 25) + g | 0, v += (p & g | ~p & h) + _[1] - 389564586 | 0, v = (v << 12 | v >>> 20) + p | 0, h += (v & p | ~v & g) + _[2] + 606105819 | 0, h = (h << 17 | h >>> 15) + v | 0, g += (h & v | ~h & p) + _[3] - 1044525330 | 0, g = (g << 22 | g >>> 10) + h | 0, p += (g & h | ~g & v) + _[4] - 176418897 | 0, p = (p << 7 | p >>> 25) + g | 0, v += (p & g | ~p & h) + _[5] + 1200080426 | 0, v = (v << 12 | v >>> 20) + p | 0, h += (v & p | ~v & g) + _[6] - 1473231341 | 0, h = (h << 17 | h >>> 15) + v | 0, g += (h & v | ~h & p) + _[7] - 45705983 | 0, g = (g << 22 | g >>> 10) + h | 0, p += (g & h | ~g & v) + _[8] + 1770035416 | 0, p = (p << 7 | p >>> 25) + g | 0, v += (p & g | ~p & h) + _[9] - 1958414417 | 0, v = (v << 12 | v >>> 20) + p | 0, h += (v & p | ~v & g) + _[10] - 42063 | 0, h = (h << 17 | h >>> 15) + v | 0, g += (h & v | ~h & p) + _[11] - 1990404162 | 0, g = (g << 22 | g >>> 10) + h | 0, p += (g & h | ~g & v) + _[12] + 1804603682 | 0, p = (p << 7 | p >>> 25) + g | 0, v += (p & g | ~p & h) + _[13] - 40341101 | 0, v = (v << 12 | v >>> 20) + p | 0, h += (v & p | ~v & g) + _[14] - 1502002290 | 0, h = (h << 17 | h >>> 15) + v | 0, g += (h & v | ~h & p) + _[15] + 1236535329 | 0, g = (g << 22 | g >>> 10) + h | 0, p += (g & v | h & ~v) + _[1] - 165796510 | 0, p = (p << 5 | p >>> 27) + g | 0, v += (p & h | g & ~h) + _[6] - 1069501632 | 0, v = (v << 9 | v >>> 23) + p | 0, h += (v & g | p & ~g) + _[11] + 643717713 | 0, h = (h << 14 | h >>> 18) + v | 0, g += (h & p | v & ~p) + _[0] - 373897302 | 0, g = (g << 20 | g >>> 12) + h | 0, p += (g & v | h & ~v) + _[5] - 701558691 | 0, p = (p << 5 | p >>> 27) + g | 0, v += (p & h | g & ~h) + _[10] + 38016083 | 0, v = (v << 9 | v >>> 23) + p | 0, h += (v & g | p & ~g) + _[15] - 660478335 | 0, h = (h << 14 | h >>> 18) + v | 0, g += (h & p | v & ~p) + _[4] - 405537848 | 0, g = (g << 20 | g >>> 12) + h | 0, p += (g & v | h & ~v) + _[9] + 568446438 | 0, p = (p << 5 | p >>> 27) + g | 0, v += (p & h | g & ~h) + _[14] - 1019803690 | 0, v = (v << 9 | v >>> 23) + p | 0, h += (v & g | p & ~g) + _[3] - 187363961 | 0, h = (h << 14 | h >>> 18) + v | 0, g += (h & p | v & ~p) + _[8] + 1163531501 | 0, g = (g << 20 | g >>> 12) + h | 0, p += (g & v | h & ~v) + _[13] - 1444681467 | 0, p = (p << 5 | p >>> 27) + g | 0, v += (p & h | g & ~h) + _[2] - 51403784 | 0, v = (v << 9 | v >>> 23) + p | 0, h += (v & g | p & ~g) + _[7] + 1735328473 | 0, h = (h << 14 | h >>> 18) + v | 0, g += (h & p | v & ~p) + _[12] - 1926607734 | 0, g = (g << 20 | g >>> 12) + h | 0, p += (g ^ h ^ v) + _[5] - 378558 | 0, p = (p << 4 | p >>> 28) + g | 0, v += (p ^ g ^ h) + _[8] - 2022574463 | 0, v = (v << 11 | v >>> 21) + p | 0, h += (v ^ p ^ g) + _[11] + 1839030562 | 0, h = (h << 16 | h >>> 16) + v | 0, g += (h ^ v ^ p) + _[14] - 35309556 | 0, g = (g << 23 | g >>> 9) + h | 0, p += (g ^ h ^ v) + _[1] - 1530992060 | 0, p = (p << 4 | p >>> 28) + g | 0, v += (p ^ g ^ h) + _[4] + 1272893353 | 0, v = (v << 11 | v >>> 21) + p | 0, h += (v ^ p ^ g) + _[7] - 155497632 | 0, h = (h << 16 | h >>> 16) + v | 0, g += (h ^ v ^ p) + _[10] - 1094730640 | 0, g = (g << 23 | g >>> 9) + h | 0, p += (g ^ h ^ v) + _[13] + 681279174 | 0, p = (p << 4 | p >>> 28) + g | 0, v += (p ^ g ^ h) + _[0] - 358537222 | 0, v = (v << 11 | v >>> 21) + p | 0, h += (v ^ p ^ g) + _[3] - 722521979 | 0, h = (h << 16 | h >>> 16) + v | 0, g += (h ^ v ^ p) + _[6] + 76029189 | 0, g = (g << 23 | g >>> 9) + h | 0, p += (g ^ h ^ v) + _[9] - 640364487 | 0, p = (p << 4 | p >>> 28) + g | 0, v += (p ^ g ^ h) + _[12] - 421815835 | 0, v = (v << 11 | v >>> 21) + p | 0, h += (v ^ p ^ g) + _[15] + 530742520 | 0, h = (h << 16 | h >>> 16) + v | 0, g += (h ^ v ^ p) + _[2] - 995338651 | 0, g = (g << 23 | g >>> 9) + h | 0, p += (h ^ (g | ~v)) + _[0] - 198630844 | 0, p = (p << 6 | p >>> 26) + g | 0, v += (g ^ (p | ~h)) + _[7] + 1126891415 | 0, v = (v << 10 | v >>> 22) + p | 0, h += (p ^ (v | ~g)) + _[14] - 1416354905 | 0, h = (h << 15 | h >>> 17) + v | 0, g += (v ^ (h | ~p)) + _[5] - 57434055 | 0, g = (g << 21 | g >>> 11) + h | 0, p += (h ^ (g | ~v)) + _[12] + 1700485571 | 0, p = (p << 6 | p >>> 26) + g | 0, v += (g ^ (p | ~h)) + _[3] - 1894986606 | 0, v = (v << 10 | v >>> 22) + p | 0, h += (p ^ (v | ~g)) + _[10] - 1051523 | 0, h = (h << 15 | h >>> 17) + v | 0, g += (v ^ (h | ~p)) + _[1] - 2054922799 | 0, g = (g << 21 | g >>> 11) + h | 0, p += (h ^ (g | ~v)) + _[8] + 1873313359 | 0, p = (p << 6 | p >>> 26) + g | 0, v += (g ^ (p | ~h)) + _[15] - 30611744 | 0, v = (v << 10 | v >>> 22) + p | 0, h += (p ^ (v | ~g)) + _[6] - 1560198380 | 0, h = (h << 15 | h >>> 17) + v | 0, g += (v ^ (h | ~p)) + _[13] + 1309151649 | 0, g = (g << 21 | g >>> 11) + h | 0, p += (h ^ (g | ~v)) + _[4] - 145523070 | 0, p = (p << 6 | p >>> 26) + g | 0, v += (g ^ (p | ~h)) + _[11] - 1120210379 | 0, v = (v << 10 | v >>> 22) + p | 0, h += (p ^ (v | ~g)) + _[2] + 718787259 | 0, h = (h << 15 | h >>> 17) + v | 0, g += (v ^ (h | ~p)) + _[9] - 343485551 | 0, g = (g << 21 | g >>> 11) + h | 0, C[0] = p + C[0] | 0, C[1] = g + C[1] | 0, C[2] = h + C[2] | 0, C[3] = v + C[3] | 0 } static _hex(C) { const _ = ue.hexChars , p = ue.hexOut; let g, h, v, V; for (V = 0; V < 4; V += 1) for (h = V * 8, g = C[V], v = 0; v < 8; v += 2) p[h + 1 + v] = _.charAt(g & 15), g >>>= 4, p[h + 0 + v] = _.charAt(g & 15), g >>>= 4; return p.join("") } };
ue.stateIdentity = new Int32Array([1732584193, -271733879, -1732584194, 271733878]); ue.buffer32Identity = new Int32Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); ue.hexChars = "0123456789abcdef"; ue.hexOut = []; ue.onePassHasher = new ue;
function getHash(str) { return ue.hashStr(str, false); }
|