├── README.md ├── a_bogus.txt ├── biliget_w.txt ├── bilipw.txt ├── huakuai_js.txt └── xxl_js.txt /README.md: -------------------------------------------------------------------------------- 1 | # js- 2 | 这里是我的js逆向代码 3 | -------------------------------------------------------------------------------- /bilipw.txt: -------------------------------------------------------------------------------- 1 | var window = {} 2 | function fun(t) { 3 | "use strict"; 4 | var e = "0123456789abcdefghijklmnopqrstuvwxyz"; 5 | function i(t) { 6 | return e.charAt(t) 7 | } 8 | function r(t, e) { 9 | return t & e 10 | } 11 | function n(t, e) { 12 | return t | e 13 | } 14 | function s(t, e) { 15 | return t ^ e 16 | } 17 | function o(t, e) { 18 | return t & ~e 19 | } 20 | function h(t) { 21 | if (0 == t) 22 | return -1; 23 | var e = 0; 24 | return 0 == (65535 & t) && (t >>= 16, 25 | e += 16), 26 | 0 == (255 & t) && (t >>= 8, 27 | e += 8), 28 | 0 == (15 & t) && (t >>= 4, 29 | e += 4), 30 | 0 == (3 & t) && (t >>= 2, 31 | e += 2), 32 | 0 == (1 & t) && ++e, 33 | e 34 | } 35 | function a(t) { 36 | for (var e = 0; 0 != t; ) 37 | t &= t - 1, 38 | ++e; 39 | return e 40 | } 41 | var u = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 42 | function c(t) { 43 | var e, i, r = ""; 44 | for (e = 0; e + 3 <= t.length; e += 3) 45 | i = parseInt(t.substring(e, e + 3), 16), 46 | r += u.charAt(i >> 6) + u.charAt(63 & i); 47 | for (e + 1 == t.length ? (i = parseInt(t.substring(e, e + 1), 16), 48 | r += u.charAt(i << 2)) : e + 2 == t.length && (i = parseInt(t.substring(e, e + 2), 16), 49 | r += u.charAt(i >> 2) + u.charAt((3 & i) << 4)); 0 < (3 & r.length); ) 50 | r += "="; 51 | return r 52 | } 53 | function f(t) { 54 | var e, r = "", n = 0, s = 0; 55 | for (e = 0; e < t.length && "=" != t.charAt(e); ++e) { 56 | var o = u.indexOf(t.charAt(e)); 57 | o < 0 || (0 == n ? (r += i(o >> 2), 58 | s = 3 & o, 59 | n = 1) : 1 == n ? (r += i(s << 2 | o >> 4), 60 | s = 15 & o, 61 | n = 2) : 2 == n ? (r += i(s), 62 | r += i(o >> 2), 63 | s = 3 & o, 64 | n = 3) : (r += i(s << 2 | o >> 4), 65 | r += i(15 & o), 66 | n = 0)) 67 | } 68 | return 1 == n && (r += i(s << 2)), 69 | r 70 | } 71 | var l, p, g = function(t, e) { 72 | return (g = Object.setPrototypeOf || { 73 | __proto__: [] 74 | }instanceof Array && function(t, e) { 75 | t.__proto__ = e 76 | } 77 | || function(t, e) { 78 | for (var i in e) 79 | e.hasOwnProperty(i) && (t[i] = e[i]) 80 | } 81 | )(t, e) 82 | }, d = function(t) { 83 | var e; 84 | if (void 0 === l) { 85 | var i = "0123456789ABCDEF" 86 | , r = " \f\n\r\t \u2028\u2029"; 87 | for (l = {}, 88 | e = 0; e < 16; ++e) 89 | l[i.charAt(e)] = e; 90 | for (i = i.toLowerCase(), 91 | e = 10; e < 16; ++e) 92 | l[i.charAt(e)] = e; 93 | for (e = 0; e < r.length; ++e) 94 | l[r.charAt(e)] = -1 95 | } 96 | var n = [] 97 | , s = 0 98 | , o = 0; 99 | for (e = 0; e < t.length; ++e) { 100 | var h = t.charAt(e); 101 | if ("=" == h) 102 | break; 103 | if (-1 != (h = l[h])) { 104 | if (void 0 === h) 105 | throw new Error("Illegal character at offset " + e); 106 | s |= h, 107 | 2 <= ++o ? (n[n.length] = s, 108 | o = s = 0) : s <<= 4 109 | } 110 | } 111 | if (o) 112 | throw new Error("Hex encoding incomplete: 4 bits missing"); 113 | return n 114 | }, v = { 115 | decode: function(t) { 116 | var e; 117 | if (void 0 === p) { 118 | var i = "= \f\n\r\t \u2028\u2029"; 119 | for (p = Object.create(null), 120 | e = 0; e < 64; ++e) 121 | p["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)] = e; 122 | for (e = 0; e < i.length; ++e) 123 | p[i.charAt(e)] = -1 124 | } 125 | var r = [] 126 | , n = 0 127 | , s = 0; 128 | for (e = 0; e < t.length; ++e) { 129 | var o = t.charAt(e); 130 | if ("=" == o) 131 | break; 132 | if (-1 != (o = p[o])) { 133 | if (void 0 === o) 134 | throw new Error("Illegal character at offset " + e); 135 | n |= o, 136 | 4 <= ++s ? (r[r.length] = n >> 16, 137 | r[r.length] = n >> 8 & 255, 138 | r[r.length] = 255 & n, 139 | s = n = 0) : n <<= 6 140 | } 141 | } 142 | switch (s) { 143 | case 1: 144 | throw new Error("Base64 encoding incomplete: at least 2 bits missing"); 145 | case 2: 146 | r[r.length] = n >> 10; 147 | break; 148 | case 3: 149 | r[r.length] = n >> 16, 150 | r[r.length] = n >> 8 & 255 151 | } 152 | return r 153 | }, 154 | re: /-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/, 155 | unarmor: function(t) { 156 | var e = v.re.exec(t); 157 | if (e) 158 | if (e[1]) 159 | t = e[1]; 160 | else { 161 | if (!e[2]) 162 | throw new Error("RegExp out of sync"); 163 | t = e[2] 164 | } 165 | return v.decode(t) 166 | } 167 | }, m = 1e13, y = function() { 168 | function t(t) { 169 | this.buf = [+t || 0] 170 | } 171 | return t.prototype.mulAdd = function(t, e) { 172 | var i, r, n = this.buf, s = n.length; 173 | for (i = 0; i < s; ++i) 174 | (r = n[i] * t + e) < m ? e = 0 : r -= (e = 0 | r / m) * m, 175 | n[i] = r; 176 | 0 < e && (n[i] = e) 177 | } 178 | , 179 | t.prototype.sub = function(t) { 180 | var e, i, r = this.buf, n = r.length; 181 | for (e = 0; e < n; ++e) 182 | (i = r[e] - t) < 0 ? (i += m, 183 | t = 1) : t = 0, 184 | r[e] = i; 185 | for (; 0 === r[r.length - 1]; ) 186 | r.pop() 187 | } 188 | , 189 | t.prototype.toString = function(t) { 190 | if (10 != (t || 10)) 191 | throw new Error("only base 10 is supported"); 192 | for (var e = this.buf, i = e[e.length - 1].toString(), r = e.length - 2; 0 <= r; --r) 193 | i += (m + e[r]).toString().substring(1); 194 | return i 195 | } 196 | , 197 | t.prototype.valueOf = function() { 198 | for (var t = this.buf, e = 0, i = t.length - 1; 0 <= i; --i) 199 | e = e * m + t[i]; 200 | return e 201 | } 202 | , 203 | t.prototype.simplify = function() { 204 | var t = this.buf; 205 | return 1 == t.length ? t[0] : this 206 | } 207 | , 208 | t 209 | }(), b = "…", T = /^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/, S = /^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/; 210 | function E(t, e) { 211 | return t.length > e && (t = t.substring(0, e) + b), 212 | t 213 | } 214 | var w, D = function() { 215 | function t(e, i) { 216 | this.hexDigits = "0123456789ABCDEF", 217 | e instanceof t ? (this.enc = e.enc, 218 | this.pos = e.pos) : (this.enc = e, 219 | this.pos = i) 220 | } 221 | return t.prototype.get = function(t) { 222 | if (void 0 === t && (t = this.pos++), 223 | t >= this.enc.length) 224 | throw new Error("Requesting byte offset " + t + " on a stream of length " + this.enc.length); 225 | return "string" == typeof this.enc ? this.enc.charCodeAt(t) : this.enc[t] 226 | } 227 | , 228 | t.prototype.hexByte = function(t) { 229 | return this.hexDigits.charAt(t >> 4 & 15) + this.hexDigits.charAt(15 & t) 230 | } 231 | , 232 | t.prototype.hexDump = function(t, e, i) { 233 | for (var r = "", n = t; n < e; ++n) 234 | if (r += this.hexByte(this.get(n)), 235 | !0 !== i) 236 | switch (15 & n) { 237 | case 7: 238 | r += " "; 239 | break; 240 | case 15: 241 | r += "\n"; 242 | break; 243 | default: 244 | r += " " 245 | } 246 | return r 247 | } 248 | , 249 | t.prototype.isASCII = function(t, e) { 250 | for (var i = t; i < e; ++i) { 251 | var r = this.get(i); 252 | if (r < 32 || 176 < r) 253 | return !1 254 | } 255 | return !0 256 | } 257 | , 258 | t.prototype.parseStringISO = function(t, e) { 259 | for (var i = "", r = t; r < e; ++r) 260 | i += String.fromCharCode(this.get(r)); 261 | return i 262 | } 263 | , 264 | t.prototype.parseStringUTF = function(t, e) { 265 | for (var i = "", r = t; r < e; ) { 266 | var n = this.get(r++); 267 | i += n < 128 ? String.fromCharCode(n) : 191 < n && n < 224 ? String.fromCharCode((31 & n) << 6 | 63 & this.get(r++)) : String.fromCharCode((15 & n) << 12 | (63 & this.get(r++)) << 6 | 63 & this.get(r++)) 268 | } 269 | return i 270 | } 271 | , 272 | t.prototype.parseStringBMP = function(t, e) { 273 | for (var i, r, n = "", s = t; s < e; ) 274 | i = this.get(s++), 275 | r = this.get(s++), 276 | n += String.fromCharCode(i << 8 | r); 277 | return n 278 | } 279 | , 280 | t.prototype.parseTime = function(t, e, i) { 281 | var r = this.parseStringISO(t, e) 282 | , n = (i ? T : S).exec(r); 283 | return n ? (i && (n[1] = +n[1], 284 | n[1] += +n[1] < 70 ? 2e3 : 1900), 285 | r = n[1] + "-" + n[2] + "-" + n[3] + " " + n[4], 286 | n[5] && (r += ":" + n[5], 287 | n[6] && (r += ":" + n[6], 288 | n[7] && (r += "." + n[7]))), 289 | n[8] && (r += " UTC", 290 | "Z" != n[8] && (r += n[8], 291 | n[9] && (r += ":" + n[9]))), 292 | r) : "Unrecognized time: " + r 293 | } 294 | , 295 | t.prototype.parseInteger = function(t, e) { 296 | for (var i, r = this.get(t), n = 127 < r, s = n ? 255 : 0, o = ""; r == s && ++t < e; ) 297 | r = this.get(t); 298 | if (0 === (i = e - t)) 299 | return n ? -1 : 0; 300 | if (4 < i) { 301 | for (o = r, 302 | i <<= 3; 0 == (128 & (+o ^ s)); ) 303 | o = +o << 1, 304 | --i; 305 | o = "(" + i + " bit)\n" 306 | } 307 | n && (r -= 256); 308 | for (var h = new y(r), a = t + 1; a < e; ++a) 309 | h.mulAdd(256, this.get(a)); 310 | return o + h.toString() 311 | } 312 | , 313 | t.prototype.parseBitString = function(t, e, i) { 314 | for (var r = this.get(t), n = "(" + ((e - t - 1 << 3) - r) + " bit)\n", s = "", o = t + 1; o < e; ++o) { 315 | for (var h = this.get(o), a = o == e - 1 ? r : 0, u = 7; a <= u; --u) 316 | s += h >> u & 1 ? "1" : "0"; 317 | if (s.length > i) 318 | return n + E(s, i) 319 | } 320 | return n + s 321 | } 322 | , 323 | t.prototype.parseOctetString = function(t, e, i) { 324 | if (this.isASCII(t, e)) 325 | return E(this.parseStringISO(t, e), i); 326 | var r = e - t 327 | , n = "(" + r + " byte)\n"; 328 | (i /= 2) < r && (e = t + i); 329 | for (var s = t; s < e; ++s) 330 | n += this.hexByte(this.get(s)); 331 | return i < r && (n += b), 332 | n 333 | } 334 | , 335 | t.prototype.parseOID = function(t, e, i) { 336 | for (var r = "", n = new y, s = 0, o = t; o < e; ++o) { 337 | var h = this.get(o); 338 | if (n.mulAdd(128, 127 & h), 339 | s += 7, 340 | !(128 & h)) { 341 | if ("" === r) 342 | if ((n = n.simplify())instanceof y) 343 | n.sub(80), 344 | r = "2." + n.toString(); 345 | else { 346 | var a = n < 80 ? n < 40 ? 0 : 1 : 2; 347 | r = a + "." + (n - 40 * a) 348 | } 349 | else 350 | r += "." + n.toString(); 351 | if (r.length > i) 352 | return E(r, i); 353 | n = new y, 354 | s = 0 355 | } 356 | } 357 | return 0 < s && (r += ".incomplete"), 358 | r 359 | } 360 | , 361 | t 362 | }(), x = function() { 363 | function t(t, e, i, r, n) { 364 | if (!(r instanceof R)) 365 | throw new Error("Invalid tag value."); 366 | this.stream = t, 367 | this.header = e, 368 | this.length = i, 369 | this.tag = r, 370 | this.sub = n 371 | } 372 | return t.prototype.typeName = function() { 373 | switch (this.tag.tagClass) { 374 | case 0: 375 | switch (this.tag.tagNumber) { 376 | case 0: 377 | return "EOC"; 378 | case 1: 379 | return "BOOLEAN"; 380 | case 2: 381 | return "INTEGER"; 382 | case 3: 383 | return "BIT_STRING"; 384 | case 4: 385 | return "OCTET_STRING"; 386 | case 5: 387 | return "NULL"; 388 | case 6: 389 | return "OBJECT_IDENTIFIER"; 390 | case 7: 391 | return "ObjectDescriptor"; 392 | case 8: 393 | return "EXTERNAL"; 394 | case 9: 395 | return "REAL"; 396 | case 10: 397 | return "ENUMERATED"; 398 | case 11: 399 | return "EMBEDDED_PDV"; 400 | case 12: 401 | return "UTF8String"; 402 | case 16: 403 | return "SEQUENCE"; 404 | case 17: 405 | return "SET"; 406 | case 18: 407 | return "NumericString"; 408 | case 19: 409 | return "PrintableString"; 410 | case 20: 411 | return "TeletexString"; 412 | case 21: 413 | return "VideotexString"; 414 | case 22: 415 | return "IA5String"; 416 | case 23: 417 | return "UTCTime"; 418 | case 24: 419 | return "GeneralizedTime"; 420 | case 25: 421 | return "GraphicString"; 422 | case 26: 423 | return "VisibleString"; 424 | case 27: 425 | return "GeneralString"; 426 | case 28: 427 | return "UniversalString"; 428 | case 30: 429 | return "BMPString" 430 | } 431 | return "Universal_" + this.tag.tagNumber.toString(); 432 | case 1: 433 | return "Application_" + this.tag.tagNumber.toString(); 434 | case 2: 435 | return "[" + this.tag.tagNumber.toString() + "]"; 436 | case 3: 437 | return "Private_" + this.tag.tagNumber.toString() 438 | } 439 | } 440 | , 441 | t.prototype.content = function(t) { 442 | if (void 0 === this.tag) 443 | return null; 444 | void 0 === t && (t = 1 / 0); 445 | var e = this.posContent() 446 | , i = Math.abs(this.length); 447 | if (!this.tag.isUniversal()) 448 | return null !== this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(e, e + i, t); 449 | switch (this.tag.tagNumber) { 450 | case 1: 451 | return 0 === this.stream.get(e) ? "false" : "true"; 452 | case 2: 453 | return this.stream.parseInteger(e, e + i); 454 | case 3: 455 | return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseBitString(e, e + i, t); 456 | case 4: 457 | return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(e, e + i, t); 458 | case 6: 459 | return this.stream.parseOID(e, e + i, t); 460 | case 16: 461 | case 17: 462 | return null !== this.sub ? "(" + this.sub.length + " elem)" : "(no elem)"; 463 | case 12: 464 | return E(this.stream.parseStringUTF(e, e + i), t); 465 | case 18: 466 | case 19: 467 | case 20: 468 | case 21: 469 | case 22: 470 | case 26: 471 | return E(this.stream.parseStringISO(e, e + i), t); 472 | case 30: 473 | return E(this.stream.parseStringBMP(e, e + i), t); 474 | case 23: 475 | case 24: 476 | return this.stream.parseTime(e, e + i, 23 == this.tag.tagNumber) 477 | } 478 | return null 479 | } 480 | , 481 | t.prototype.toString = function() { 482 | return this.typeName() + "@" + this.stream.pos + "[header:" + this.header + ",length:" + this.length + ",sub:" + (null === this.sub ? "null" : this.sub.length) + "]" 483 | } 484 | , 485 | t.prototype.toPrettyString = function(t) { 486 | void 0 === t && (t = ""); 487 | var e = t + this.typeName() + " @" + this.stream.pos; 488 | if (0 <= this.length && (e += "+"), 489 | e += this.length, 490 | this.tag.tagConstructed ? e += " (constructed)" : !this.tag.isUniversal() || 3 != this.tag.tagNumber && 4 != this.tag.tagNumber || null === this.sub || (e += " (encapsulates)"), 491 | e += "\n", 492 | null !== this.sub) { 493 | t += " "; 494 | for (var i = 0, r = this.sub.length; i < r; ++i) 495 | e += this.sub[i].toPrettyString(t) 496 | } 497 | return e 498 | } 499 | , 500 | t.prototype.posStart = function() { 501 | return this.stream.pos 502 | } 503 | , 504 | t.prototype.posContent = function() { 505 | return this.stream.pos + this.header 506 | } 507 | , 508 | t.prototype.posEnd = function() { 509 | return this.stream.pos + this.header + Math.abs(this.length) 510 | } 511 | , 512 | t.prototype.toHexString = function() { 513 | return this.stream.hexDump(this.posStart(), this.posEnd(), !0) 514 | } 515 | , 516 | t.decodeLength = function(t) { 517 | var e = t.get() 518 | , i = 127 & e; 519 | if (i == e) 520 | return i; 521 | if (6 < i) 522 | throw new Error("Length over 48 bits not supported at position " + (t.pos - 1)); 523 | if (0 === i) 524 | return null; 525 | for (var r = e = 0; r < i; ++r) 526 | e = 256 * e + t.get(); 527 | return e 528 | } 529 | , 530 | t.prototype.getHexStringValue = function() { 531 | var t = this.toHexString() 532 | , e = 2 * this.header 533 | , i = 2 * this.length; 534 | return t.substr(e, i) 535 | } 536 | , 537 | t.decode = function(e) { 538 | var i; 539 | i = e instanceof D ? e : new D(e,0); 540 | var r = new D(i) 541 | , n = new R(i) 542 | , s = t.decodeLength(i) 543 | , o = i.pos 544 | , h = o - r.pos 545 | , a = null 546 | , u = function() { 547 | var e = []; 548 | if (null !== s) { 549 | for (var r = o + s; i.pos < r; ) 550 | e[e.length] = t.decode(i); 551 | if (i.pos != r) 552 | throw new Error("Content size is not correct for container starting at offset " + o) 553 | } else 554 | try { 555 | for (; ; ) { 556 | var n = t.decode(i); 557 | if (n.tag.isEOC()) 558 | break; 559 | e[e.length] = n 560 | } 561 | s = o - i.pos 562 | } catch (e) { 563 | throw new Error("Exception while decoding undefined length content: " + e) 564 | } 565 | return e 566 | }; 567 | if (n.tagConstructed) 568 | a = u(); 569 | else if (n.isUniversal() && (3 == n.tagNumber || 4 == n.tagNumber)) 570 | try { 571 | if (3 == n.tagNumber && 0 != i.get()) 572 | throw new Error("BIT STRINGs with unused bits cannot encapsulate."); 573 | a = u(); 574 | for (var c = 0; c < a.length; ++c) 575 | if (a[c].tag.isEOC()) 576 | throw new Error("EOC is not supposed to be actual content.") 577 | } catch (e) { 578 | a = null 579 | } 580 | if (null === a) { 581 | if (null === s) 582 | throw new Error("We can't skip over an invalid tag with undefined length at offset " + o); 583 | i.pos = o + Math.abs(s) 584 | } 585 | return new t(r,h,s,n,a) 586 | } 587 | , 588 | t 589 | }(), R = function() { 590 | function t(t) { 591 | var e = t.get(); 592 | if (this.tagClass = e >> 6, 593 | this.tagConstructed = 0 != (32 & e), 594 | this.tagNumber = 31 & e, 595 | 31 == this.tagNumber) { 596 | for (var i = new y; e = t.get(), 597 | i.mulAdd(128, 127 & e), 598 | 128 & e; ) 599 | ; 600 | this.tagNumber = i.simplify() 601 | } 602 | } 603 | return t.prototype.isUniversal = function() { 604 | return 0 === this.tagClass 605 | } 606 | , 607 | t.prototype.isEOC = function() { 608 | return 0 === this.tagClass && 0 === this.tagNumber 609 | } 610 | , 611 | t 612 | }(), B = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997], A = (1 << 26) / B[B.length - 1], O = function() { 613 | function t(t, e, i) { 614 | null != t && ("number" == typeof t ? this.fromNumber(t, e, i) : null == e && "string" != typeof t ? this.fromString(t, 256) : this.fromString(t, e)) 615 | } 616 | return t.prototype.toString = function(t) { 617 | if (this.s < 0) 618 | return "-" + this.negate().toString(t); 619 | var e; 620 | if (16 == t) 621 | e = 4; 622 | else if (8 == t) 623 | e = 3; 624 | else if (2 == t) 625 | e = 1; 626 | else if (32 == t) 627 | e = 5; 628 | else { 629 | if (4 != t) 630 | return this.toRadix(t); 631 | e = 2 632 | } 633 | var r, n = (1 << e) - 1, s = !1, o = "", h = this.t, a = this.DB - h * this.DB % e; 634 | if (0 < h--) 635 | for (a < this.DB && 0 < (r = this[h] >> a) && (s = !0, 636 | o = i(r)); 0 <= h; ) 637 | a < e ? (r = (this[h] & (1 << a) - 1) << e - a, 638 | r |= this[--h] >> (a += this.DB - e)) : (r = this[h] >> (a -= e) & n, 639 | a <= 0 && (a += this.DB, 640 | --h)), 641 | 0 < r && (s = !0), 642 | s && (o += i(r)); 643 | return s ? o : "0" 644 | } 645 | , 646 | t.prototype.negate = function() { 647 | var e = M(); 648 | return t.ZERO.subTo(this, e), 649 | e 650 | } 651 | , 652 | t.prototype.abs = function() { 653 | return this.s < 0 ? this.negate() : this 654 | } 655 | , 656 | t.prototype.compareTo = function(t) { 657 | var e = this.s - t.s; 658 | if (0 != e) 659 | return e; 660 | var i = this.t; 661 | if (0 != (e = i - t.t)) 662 | return this.s < 0 ? -e : e; 663 | for (; 0 <= --i; ) 664 | if (0 != (e = this[i] - t[i])) 665 | return e; 666 | return 0 667 | } 668 | , 669 | t.prototype.bitLength = function() { 670 | return this.t <= 0 ? 0 : this.DB * (this.t - 1) + U(this[this.t - 1] ^ this.s & this.DM) 671 | } 672 | , 673 | t.prototype.mod = function(e) { 674 | var i = M(); 675 | return this.abs().divRemTo(e, null, i), 676 | this.s < 0 && 0 < i.compareTo(t.ZERO) && e.subTo(i, i), 677 | i 678 | } 679 | , 680 | t.prototype.modPowInt = function(t, e) { 681 | var i; 682 | return i = t < 256 || e.isEven() ? new I(e) : new N(e), 683 | this.exp(t, i) 684 | } 685 | , 686 | t.prototype.clone = function() { 687 | var t = M(); 688 | return this.copyTo(t), 689 | t 690 | } 691 | , 692 | t.prototype.intValue = function() { 693 | if (this.s < 0) { 694 | if (1 == this.t) 695 | return this[0] - this.DV; 696 | if (0 == this.t) 697 | return -1 698 | } else { 699 | if (1 == this.t) 700 | return this[0]; 701 | if (0 == this.t) 702 | return 0 703 | } 704 | return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0] 705 | } 706 | , 707 | t.prototype.byteValue = function() { 708 | return 0 == this.t ? this.s : this[0] << 24 >> 24 709 | } 710 | , 711 | t.prototype.shortValue = function() { 712 | return 0 == this.t ? this.s : this[0] << 16 >> 16 713 | } 714 | , 715 | t.prototype.signum = function() { 716 | return this.s < 0 ? -1 : this.t <= 0 || 1 == this.t && this[0] <= 0 ? 0 : 1 717 | } 718 | , 719 | t.prototype.toByteArray = function() { 720 | var t = this.t 721 | , e = []; 722 | e[0] = this.s; 723 | var i, r = this.DB - t * this.DB % 8, n = 0; 724 | if (0 < t--) 725 | for (r < this.DB && (i = this[t] >> r) != (this.s & this.DM) >> r && (e[n++] = i | this.s << this.DB - r); 0 <= t; ) 726 | r < 8 ? (i = (this[t] & (1 << r) - 1) << 8 - r, 727 | i |= this[--t] >> (r += this.DB - 8)) : (i = this[t] >> (r -= 8) & 255, 728 | r <= 0 && (r += this.DB, 729 | --t)), 730 | 0 != (128 & i) && (i |= -256), 731 | 0 == n && (128 & this.s) != (128 & i) && ++n, 732 | (0 < n || i != this.s) && (e[n++] = i); 733 | return e 734 | } 735 | , 736 | t.prototype.equals = function(t) { 737 | return 0 == this.compareTo(t) 738 | } 739 | , 740 | t.prototype.min = function(t) { 741 | return this.compareTo(t) < 0 ? this : t 742 | } 743 | , 744 | t.prototype.max = function(t) { 745 | return 0 < this.compareTo(t) ? this : t 746 | } 747 | , 748 | t.prototype.and = function(t) { 749 | var e = M(); 750 | return this.bitwiseTo(t, r, e), 751 | e 752 | } 753 | , 754 | t.prototype.or = function(t) { 755 | var e = M(); 756 | return this.bitwiseTo(t, n, e), 757 | e 758 | } 759 | , 760 | t.prototype.xor = function(t) { 761 | var e = M(); 762 | return this.bitwiseTo(t, s, e), 763 | e 764 | } 765 | , 766 | t.prototype.andNot = function(t) { 767 | var e = M(); 768 | return this.bitwiseTo(t, o, e), 769 | e 770 | } 771 | , 772 | t.prototype.not = function() { 773 | for (var t = M(), e = 0; e < this.t; ++e) 774 | t[e] = this.DM & ~this[e]; 775 | return t.t = this.t, 776 | t.s = ~this.s, 777 | t 778 | } 779 | , 780 | t.prototype.shiftLeft = function(t) { 781 | var e = M(); 782 | return t < 0 ? this.rShiftTo(-t, e) : this.lShiftTo(t, e), 783 | e 784 | } 785 | , 786 | t.prototype.shiftRight = function(t) { 787 | var e = M(); 788 | return t < 0 ? this.lShiftTo(-t, e) : this.rShiftTo(t, e), 789 | e 790 | } 791 | , 792 | t.prototype.getLowestSetBit = function() { 793 | for (var t = 0; t < this.t; ++t) 794 | if (0 != this[t]) 795 | return t * this.DB + h(this[t]); 796 | return this.s < 0 ? this.t * this.DB : -1 797 | } 798 | , 799 | t.prototype.bitCount = function() { 800 | for (var t = 0, e = this.s & this.DM, i = 0; i < this.t; ++i) 801 | t += a(this[i] ^ e); 802 | return t 803 | } 804 | , 805 | t.prototype.testBit = function(t) { 806 | var e = Math.floor(t / this.DB); 807 | return e >= this.t ? 0 != this.s : 0 != (this[e] & 1 << t % this.DB) 808 | } 809 | , 810 | t.prototype.setBit = function(t) { 811 | return this.changeBit(t, n) 812 | } 813 | , 814 | t.prototype.clearBit = function(t) { 815 | return this.changeBit(t, o) 816 | } 817 | , 818 | t.prototype.flipBit = function(t) { 819 | return this.changeBit(t, s) 820 | } 821 | , 822 | t.prototype.add = function(t) { 823 | var e = M(); 824 | return this.addTo(t, e), 825 | e 826 | } 827 | , 828 | t.prototype.subtract = function(t) { 829 | var e = M(); 830 | return this.subTo(t, e), 831 | e 832 | } 833 | , 834 | t.prototype.multiply = function(t) { 835 | var e = M(); 836 | return this.multiplyTo(t, e), 837 | e 838 | } 839 | , 840 | t.prototype.divide = function(t) { 841 | var e = M(); 842 | return this.divRemTo(t, e, null), 843 | e 844 | } 845 | , 846 | t.prototype.remainder = function(t) { 847 | var e = M(); 848 | return this.divRemTo(t, null, e), 849 | e 850 | } 851 | , 852 | t.prototype.divideAndRemainder = function(t) { 853 | var e = M() 854 | , i = M(); 855 | return this.divRemTo(t, e, i), 856 | [e, i] 857 | } 858 | , 859 | t.prototype.modPow = function(t, e) { 860 | var i, r, n = t.bitLength(), s = F(1); 861 | if (n <= 0) 862 | return s; 863 | i = n < 18 ? 1 : n < 48 ? 3 : n < 144 ? 4 : n < 768 ? 5 : 6, 864 | r = n < 8 ? new I(e) : e.isEven() ? new P(e) : new N(e); 865 | var o = [] 866 | , h = 3 867 | , a = i - 1 868 | , u = (1 << i) - 1; 869 | if (o[1] = r.convert(this), 870 | 1 < i) { 871 | var c = M(); 872 | for (r.sqrTo(o[1], c); h <= u; ) 873 | o[h] = M(), 874 | r.mulTo(c, o[h - 2], o[h]), 875 | h += 2 876 | } 877 | var f, l, p = t.t - 1, g = !0, d = M(); 878 | for (n = U(t[p]) - 1; 0 <= p; ) { 879 | for (a <= n ? f = t[p] >> n - a & u : (f = (t[p] & (1 << n + 1) - 1) << a - n, 880 | 0 < p && (f |= t[p - 1] >> this.DB + n - a)), 881 | h = i; 0 == (1 & f); ) 882 | f >>= 1, 883 | --h; 884 | if ((n -= h) < 0 && (n += this.DB, 885 | --p), 886 | g) 887 | o[f].copyTo(s), 888 | g = !1; 889 | else { 890 | for (; 1 < h; ) 891 | r.sqrTo(s, d), 892 | r.sqrTo(d, s), 893 | h -= 2; 894 | 0 < h ? r.sqrTo(s, d) : (l = s, 895 | s = d, 896 | d = l), 897 | r.mulTo(d, o[f], s) 898 | } 899 | for (; 0 <= p && 0 == (t[p] & 1 << n); ) 900 | r.sqrTo(s, d), 901 | l = s, 902 | s = d, 903 | d = l, 904 | --n < 0 && (n = this.DB - 1, 905 | --p) 906 | } 907 | return r.revert(s) 908 | } 909 | , 910 | t.prototype.modInverse = function(e) { 911 | var i = e.isEven(); 912 | if (this.isEven() && i || 0 == e.signum()) 913 | return t.ZERO; 914 | for (var r = e.clone(), n = this.clone(), s = F(1), o = F(0), h = F(0), a = F(1); 0 != r.signum(); ) { 915 | for (; r.isEven(); ) 916 | r.rShiftTo(1, r), 917 | i ? (s.isEven() && o.isEven() || (s.addTo(this, s), 918 | o.subTo(e, o)), 919 | s.rShiftTo(1, s)) : o.isEven() || o.subTo(e, o), 920 | o.rShiftTo(1, o); 921 | for (; n.isEven(); ) 922 | n.rShiftTo(1, n), 923 | i ? (h.isEven() && a.isEven() || (h.addTo(this, h), 924 | a.subTo(e, a)), 925 | h.rShiftTo(1, h)) : a.isEven() || a.subTo(e, a), 926 | a.rShiftTo(1, a); 927 | 0 <= r.compareTo(n) ? (r.subTo(n, r), 928 | i && s.subTo(h, s), 929 | o.subTo(a, o)) : (n.subTo(r, n), 930 | i && h.subTo(s, h), 931 | a.subTo(o, a)) 932 | } 933 | return 0 != n.compareTo(t.ONE) ? t.ZERO : 0 <= a.compareTo(e) ? a.subtract(e) : a.signum() < 0 ? (a.addTo(e, a), 934 | a.signum() < 0 ? a.add(e) : a) : a 935 | } 936 | , 937 | t.prototype.pow = function(t) { 938 | return this.exp(t, new V) 939 | } 940 | , 941 | t.prototype.gcd = function(t) { 942 | var e = this.s < 0 ? this.negate() : this.clone() 943 | , i = t.s < 0 ? t.negate() : t.clone(); 944 | if (e.compareTo(i) < 0) { 945 | var r = e; 946 | e = i, 947 | i = r 948 | } 949 | var n = e.getLowestSetBit() 950 | , s = i.getLowestSetBit(); 951 | if (s < 0) 952 | return e; 953 | for (n < s && (s = n), 954 | 0 < s && (e.rShiftTo(s, e), 955 | i.rShiftTo(s, i)); 0 < e.signum(); ) 956 | 0 < (n = e.getLowestSetBit()) && e.rShiftTo(n, e), 957 | 0 < (n = i.getLowestSetBit()) && i.rShiftTo(n, i), 958 | 0 <= e.compareTo(i) ? (e.subTo(i, e), 959 | e.rShiftTo(1, e)) : (i.subTo(e, i), 960 | i.rShiftTo(1, i)); 961 | return 0 < s && i.lShiftTo(s, i), 962 | i 963 | } 964 | , 965 | t.prototype.isProbablePrime = function(t) { 966 | var e, i = this.abs(); 967 | if (1 == i.t && i[0] <= B[B.length - 1]) { 968 | for (e = 0; e < B.length; ++e) 969 | if (i[0] == B[e]) 970 | return !0; 971 | return !1 972 | } 973 | if (i.isEven()) 974 | return !1; 975 | for (e = 1; e < B.length; ) { 976 | for (var r = B[e], n = e + 1; n < B.length && r < A; ) 977 | r *= B[n++]; 978 | for (r = i.modInt(r); e < n; ) 979 | if (r % B[e++] == 0) 980 | return !1 981 | } 982 | return i.millerRabin(t) 983 | } 984 | , 985 | t.prototype.copyTo = function(t) { 986 | for (var e = this.t - 1; 0 <= e; --e) 987 | t[e] = this[e]; 988 | t.t = this.t, 989 | t.s = this.s 990 | } 991 | , 992 | t.prototype.fromInt = function(t) { 993 | this.t = 1, 994 | this.s = t < 0 ? -1 : 0, 995 | 0 < t ? this[0] = t : t < -1 ? this[0] = t + this.DV : this.t = 0 996 | } 997 | , 998 | t.prototype.fromString = function(e, i) { 999 | var r; 1000 | if (16 == i) 1001 | r = 4; 1002 | else if (8 == i) 1003 | r = 3; 1004 | else if (256 == i) 1005 | r = 8; 1006 | else if (2 == i) 1007 | r = 1; 1008 | else if (32 == i) 1009 | r = 5; 1010 | else { 1011 | if (4 != i) 1012 | return void this.fromRadix(e, i); 1013 | r = 2 1014 | } 1015 | this.t = 0, 1016 | this.s = 0; 1017 | for (var n = e.length, s = !1, o = 0; 0 <= --n; ) { 1018 | var h = 8 == r ? 255 & +e[n] : C(e, n); 1019 | h < 0 ? "-" == e.charAt(n) && (s = !0) : (s = !1, 1020 | 0 == o ? this[this.t++] = h : o + r > this.DB ? (this[this.t - 1] |= (h & (1 << this.DB - o) - 1) << o, 1021 | this[this.t++] = h >> this.DB - o) : this[this.t - 1] |= h << o, 1022 | (o += r) >= this.DB && (o -= this.DB)) 1023 | } 1024 | 8 == r && 0 != (128 & +e[0]) && (this.s = -1, 1025 | 0 < o && (this[this.t - 1] |= (1 << this.DB - o) - 1 << o)), 1026 | this.clamp(), 1027 | s && t.ZERO.subTo(this, this) 1028 | } 1029 | , 1030 | t.prototype.clamp = function() { 1031 | for (var t = this.s & this.DM; 0 < this.t && this[this.t - 1] == t; ) 1032 | --this.t 1033 | } 1034 | , 1035 | t.prototype.dlShiftTo = function(t, e) { 1036 | var i; 1037 | for (i = this.t - 1; 0 <= i; --i) 1038 | e[i + t] = this[i]; 1039 | for (i = t - 1; 0 <= i; --i) 1040 | e[i] = 0; 1041 | e.t = this.t + t, 1042 | e.s = this.s 1043 | } 1044 | , 1045 | t.prototype.drShiftTo = function(t, e) { 1046 | for (var i = t; i < this.t; ++i) 1047 | e[i - t] = this[i]; 1048 | e.t = Math.max(this.t - t, 0), 1049 | e.s = this.s 1050 | } 1051 | , 1052 | t.prototype.lShiftTo = function(t, e) { 1053 | for (var i = t % this.DB, r = this.DB - i, n = (1 << r) - 1, s = Math.floor(t / this.DB), o = this.s << i & this.DM, h = this.t - 1; 0 <= h; --h) 1054 | e[h + s + 1] = this[h] >> r | o, 1055 | o = (this[h] & n) << i; 1056 | for (h = s - 1; 0 <= h; --h) 1057 | e[h] = 0; 1058 | e[s] = o, 1059 | e.t = this.t + s + 1, 1060 | e.s = this.s, 1061 | e.clamp() 1062 | } 1063 | , 1064 | t.prototype.rShiftTo = function(t, e) { 1065 | e.s = this.s; 1066 | var i = Math.floor(t / this.DB); 1067 | if (i >= this.t) 1068 | e.t = 0; 1069 | else { 1070 | var r = t % this.DB 1071 | , n = this.DB - r 1072 | , s = (1 << r) - 1; 1073 | e[0] = this[i] >> r; 1074 | for (var o = i + 1; o < this.t; ++o) 1075 | e[o - i - 1] |= (this[o] & s) << n, 1076 | e[o - i] = this[o] >> r; 1077 | 0 < r && (e[this.t - i - 1] |= (this.s & s) << n), 1078 | e.t = this.t - i, 1079 | e.clamp() 1080 | } 1081 | } 1082 | , 1083 | t.prototype.subTo = function(t, e) { 1084 | for (var i = 0, r = 0, n = Math.min(t.t, this.t); i < n; ) 1085 | r += this[i] - t[i], 1086 | e[i++] = r & this.DM, 1087 | r >>= this.DB; 1088 | if (t.t < this.t) { 1089 | for (r -= t.s; i < this.t; ) 1090 | r += this[i], 1091 | e[i++] = r & this.DM, 1092 | r >>= this.DB; 1093 | r += this.s 1094 | } else { 1095 | for (r += this.s; i < t.t; ) 1096 | r -= t[i], 1097 | e[i++] = r & this.DM, 1098 | r >>= this.DB; 1099 | r -= t.s 1100 | } 1101 | e.s = r < 0 ? -1 : 0, 1102 | r < -1 ? e[i++] = this.DV + r : 0 < r && (e[i++] = r), 1103 | e.t = i, 1104 | e.clamp() 1105 | } 1106 | , 1107 | t.prototype.multiplyTo = function(e, i) { 1108 | var r = this.abs() 1109 | , n = e.abs() 1110 | , s = r.t; 1111 | for (i.t = s + n.t; 0 <= --s; ) 1112 | i[s] = 0; 1113 | for (s = 0; s < n.t; ++s) 1114 | i[s + r.t] = r.am(0, n[s], i, s, 0, r.t); 1115 | i.s = 0, 1116 | i.clamp(), 1117 | this.s != e.s && t.ZERO.subTo(i, i) 1118 | } 1119 | , 1120 | t.prototype.squareTo = function(t) { 1121 | for (var e = this.abs(), i = t.t = 2 * e.t; 0 <= --i; ) 1122 | t[i] = 0; 1123 | for (i = 0; i < e.t - 1; ++i) { 1124 | var r = e.am(i, e[i], t, 2 * i, 0, 1); 1125 | (t[i + e.t] += e.am(i + 1, 2 * e[i], t, 2 * i + 1, r, e.t - i - 1)) >= e.DV && (t[i + e.t] -= e.DV, 1126 | t[i + e.t + 1] = 1) 1127 | } 1128 | 0 < t.t && (t[t.t - 1] += e.am(i, e[i], t, 2 * i, 0, 1)), 1129 | t.s = 0, 1130 | t.clamp() 1131 | } 1132 | , 1133 | t.prototype.divRemTo = function(e, i, r) { 1134 | var n = e.abs(); 1135 | if (!(n.t <= 0)) { 1136 | var s = this.abs(); 1137 | if (s.t < n.t) 1138 | return null != i && i.fromInt(0), 1139 | void (null != r && this.copyTo(r)); 1140 | null == r && (r = M()); 1141 | var o = M() 1142 | , h = this.s 1143 | , a = e.s 1144 | , u = this.DB - U(n[n.t - 1]); 1145 | 0 < u ? (n.lShiftTo(u, o), 1146 | s.lShiftTo(u, r)) : (n.copyTo(o), 1147 | s.copyTo(r)); 1148 | var c = o.t 1149 | , f = o[c - 1]; 1150 | if (0 != f) { 1151 | var l = f * (1 << this.F1) + (1 < c ? o[c - 2] >> this.F2 : 0) 1152 | , p = this.FV / l 1153 | , g = (1 << this.F1) / l 1154 | , d = 1 << this.F2 1155 | , v = r.t 1156 | , m = v - c 1157 | , y = null == i ? M() : i; 1158 | for (o.dlShiftTo(m, y), 1159 | 0 <= r.compareTo(y) && (r[r.t++] = 1, 1160 | r.subTo(y, r)), 1161 | t.ONE.dlShiftTo(c, y), 1162 | y.subTo(o, o); o.t < c; ) 1163 | o[o.t++] = 0; 1164 | for (; 0 <= --m; ) { 1165 | var b = r[--v] == f ? this.DM : Math.floor(r[v] * p + (r[v - 1] + d) * g); 1166 | if ((r[v] += o.am(0, b, r, m, 0, c)) < b) 1167 | for (o.dlShiftTo(m, y), 1168 | r.subTo(y, r); r[v] < --b; ) 1169 | r.subTo(y, r) 1170 | } 1171 | null != i && (r.drShiftTo(c, i), 1172 | h != a && t.ZERO.subTo(i, i)), 1173 | r.t = c, 1174 | r.clamp(), 1175 | 0 < u && r.rShiftTo(u, r), 1176 | h < 0 && t.ZERO.subTo(r, r) 1177 | } 1178 | } 1179 | } 1180 | , 1181 | t.prototype.invDigit = function() { 1182 | if (this.t < 1) 1183 | return 0; 1184 | var t = this[0]; 1185 | if (0 == (1 & t)) 1186 | return 0; 1187 | var e = 3 & t; 1188 | return 0 < (e = (e = (e = (e = e * (2 - (15 & t) * e) & 15) * (2 - (255 & t) * e) & 255) * (2 - ((65535 & t) * e & 65535)) & 65535) * (2 - t * e % this.DV) % this.DV) ? this.DV - e : -e 1189 | } 1190 | , 1191 | t.prototype.isEven = function() { 1192 | return 0 == (0 < this.t ? 1 & this[0] : this.s) 1193 | } 1194 | , 1195 | t.prototype.exp = function(e, i) { 1196 | if (4294967295 < e || e < 1) 1197 | return t.ONE; 1198 | var r = M() 1199 | , n = M() 1200 | , s = i.convert(this) 1201 | , o = U(e) - 1; 1202 | for (s.copyTo(r); 0 <= --o; ) 1203 | if (i.sqrTo(r, n), 1204 | 0 < (e & 1 << o)) 1205 | i.mulTo(n, s, r); 1206 | else { 1207 | var h = r; 1208 | r = n, 1209 | n = h 1210 | } 1211 | return i.revert(r) 1212 | } 1213 | , 1214 | t.prototype.chunkSize = function(t) { 1215 | return Math.floor(Math.LN2 * this.DB / Math.log(t)) 1216 | } 1217 | , 1218 | t.prototype.toRadix = function(t) { 1219 | if (null == t && (t = 10), 1220 | 0 == this.signum() || t < 2 || 36 < t) 1221 | return "0"; 1222 | var e = this.chunkSize(t) 1223 | , i = Math.pow(t, e) 1224 | , r = F(i) 1225 | , n = M() 1226 | , s = M() 1227 | , o = ""; 1228 | for (this.divRemTo(r, n, s); 0 < n.signum(); ) 1229 | o = (i + s.intValue()).toString(t).substr(1) + o, 1230 | n.divRemTo(r, n, s); 1231 | return s.intValue().toString(t) + o 1232 | } 1233 | , 1234 | t.prototype.fromRadix = function(e, i) { 1235 | this.fromInt(0), 1236 | null == i && (i = 10); 1237 | for (var r = this.chunkSize(i), n = Math.pow(i, r), s = !1, o = 0, h = 0, a = 0; a < e.length; ++a) { 1238 | var u = C(e, a); 1239 | u < 0 ? "-" == e.charAt(a) && 0 == this.signum() && (s = !0) : (h = i * h + u, 1240 | ++o >= r && (this.dMultiply(n), 1241 | this.dAddOffset(h, 0), 1242 | h = o = 0)) 1243 | } 1244 | 0 < o && (this.dMultiply(Math.pow(i, o)), 1245 | this.dAddOffset(h, 0)), 1246 | s && t.ZERO.subTo(this, this) 1247 | } 1248 | , 1249 | t.prototype.fromNumber = function(e, i, r) { 1250 | if ("number" == typeof i) 1251 | if (e < 2) 1252 | this.fromInt(1); 1253 | else 1254 | for (this.fromNumber(e, r), 1255 | this.testBit(e - 1) || this.bitwiseTo(t.ONE.shiftLeft(e - 1), n, this), 1256 | this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(i); ) 1257 | this.dAddOffset(2, 0), 1258 | this.bitLength() > e && this.subTo(t.ONE.shiftLeft(e - 1), this); 1259 | else { 1260 | var s = [] 1261 | , o = 7 & e; 1262 | s.length = 1 + (e >> 3), 1263 | i.nextBytes(s), 1264 | 0 < o ? s[0] &= (1 << o) - 1 : s[0] = 0, 1265 | this.fromString(s, 256) 1266 | } 1267 | } 1268 | , 1269 | t.prototype.bitwiseTo = function(t, e, i) { 1270 | var r, n, s = Math.min(t.t, this.t); 1271 | for (r = 0; r < s; ++r) 1272 | i[r] = e(this[r], t[r]); 1273 | if (t.t < this.t) { 1274 | for (n = t.s & this.DM, 1275 | r = s; r < this.t; ++r) 1276 | i[r] = e(this[r], n); 1277 | i.t = this.t 1278 | } else { 1279 | for (n = this.s & this.DM, 1280 | r = s; r < t.t; ++r) 1281 | i[r] = e(n, t[r]); 1282 | i.t = t.t 1283 | } 1284 | i.s = e(this.s, t.s), 1285 | i.clamp() 1286 | } 1287 | , 1288 | t.prototype.changeBit = function(e, i) { 1289 | var r = t.ONE.shiftLeft(e); 1290 | return this.bitwiseTo(r, i, r), 1291 | r 1292 | } 1293 | , 1294 | t.prototype.addTo = function(t, e) { 1295 | for (var i = 0, r = 0, n = Math.min(t.t, this.t); i < n; ) 1296 | r += this[i] + t[i], 1297 | e[i++] = r & this.DM, 1298 | r >>= this.DB; 1299 | if (t.t < this.t) { 1300 | for (r += t.s; i < this.t; ) 1301 | r += this[i], 1302 | e[i++] = r & this.DM, 1303 | r >>= this.DB; 1304 | r += this.s 1305 | } else { 1306 | for (r += this.s; i < t.t; ) 1307 | r += t[i], 1308 | e[i++] = r & this.DM, 1309 | r >>= this.DB; 1310 | r += t.s 1311 | } 1312 | e.s = r < 0 ? -1 : 0, 1313 | 0 < r ? e[i++] = r : r < -1 && (e[i++] = this.DV + r), 1314 | e.t = i, 1315 | e.clamp() 1316 | } 1317 | , 1318 | t.prototype.dMultiply = function(t) { 1319 | this[this.t] = this.am(0, t - 1, this, 0, 0, this.t), 1320 | ++this.t, 1321 | this.clamp() 1322 | } 1323 | , 1324 | t.prototype.dAddOffset = function(t, e) { 1325 | if (0 != t) { 1326 | for (; this.t <= e; ) 1327 | this[this.t++] = 0; 1328 | for (this[e] += t; this[e] >= this.DV; ) 1329 | this[e] -= this.DV, 1330 | ++e >= this.t && (this[this.t++] = 0), 1331 | ++this[e] 1332 | } 1333 | } 1334 | , 1335 | t.prototype.multiplyLowerTo = function(t, e, i) { 1336 | var r = Math.min(this.t + t.t, e); 1337 | for (i.s = 0, 1338 | i.t = r; 0 < r; ) 1339 | i[--r] = 0; 1340 | for (var n = i.t - this.t; r < n; ++r) 1341 | i[r + this.t] = this.am(0, t[r], i, r, 0, this.t); 1342 | for (n = Math.min(t.t, e); r < n; ++r) 1343 | this.am(0, t[r], i, r, 0, e - r); 1344 | i.clamp() 1345 | } 1346 | , 1347 | t.prototype.multiplyUpperTo = function(t, e, i) { 1348 | --e; 1349 | var r = i.t = this.t + t.t - e; 1350 | for (i.s = 0; 0 <= --r; ) 1351 | i[r] = 0; 1352 | for (r = Math.max(e - this.t, 0); r < t.t; ++r) 1353 | i[this.t + r - e] = this.am(e - r, t[r], i, 0, 0, this.t + r - e); 1354 | i.clamp(), 1355 | i.drShiftTo(1, i) 1356 | } 1357 | , 1358 | t.prototype.modInt = function(t) { 1359 | if (t <= 0) 1360 | return 0; 1361 | var e = this.DV % t 1362 | , i = this.s < 0 ? t - 1 : 0; 1363 | if (0 < this.t) 1364 | if (0 == e) 1365 | i = this[0] % t; 1366 | else 1367 | for (var r = this.t - 1; 0 <= r; --r) 1368 | i = (e * i + this[r]) % t; 1369 | return i 1370 | } 1371 | , 1372 | t.prototype.millerRabin = function(e) { 1373 | var i = this.subtract(t.ONE) 1374 | , r = i.getLowestSetBit(); 1375 | if (r <= 0) 1376 | return !1; 1377 | var n = i.shiftRight(r); 1378 | B.length < (e = e + 1 >> 1) && (e = B.length); 1379 | for (var s = M(), o = 0; o < e; ++o) { 1380 | s.fromInt(B[Math.floor(Math.random() * B.length)]); 1381 | var h = s.modPow(n, this); 1382 | if (0 != h.compareTo(t.ONE) && 0 != h.compareTo(i)) { 1383 | for (var a = 1; a++ < r && 0 != h.compareTo(i); ) 1384 | if (0 == (h = h.modPowInt(2, this)).compareTo(t.ONE)) 1385 | return !1; 1386 | if (0 != h.compareTo(i)) 1387 | return !1 1388 | } 1389 | } 1390 | return !0 1391 | } 1392 | , 1393 | t.prototype.square = function() { 1394 | var t = M(); 1395 | return this.squareTo(t), 1396 | t 1397 | } 1398 | , 1399 | t.prototype.gcda = function(t, e) { 1400 | var i = this.s < 0 ? this.negate() : this.clone() 1401 | , r = t.s < 0 ? t.negate() : t.clone(); 1402 | if (i.compareTo(r) < 0) { 1403 | var n = i; 1404 | i = r, 1405 | r = n 1406 | } 1407 | var s = i.getLowestSetBit() 1408 | , o = r.getLowestSetBit(); 1409 | if (o < 0) 1410 | e(i); 1411 | else { 1412 | s < o && (o = s), 1413 | 0 < o && (i.rShiftTo(o, i), 1414 | r.rShiftTo(o, r)); 1415 | var h = function() { 1416 | 0 < (s = i.getLowestSetBit()) && i.rShiftTo(s, i), 1417 | 0 < (s = r.getLowestSetBit()) && r.rShiftTo(s, r), 1418 | 0 <= i.compareTo(r) ? (i.subTo(r, i), 1419 | i.rShiftTo(1, i)) : (r.subTo(i, r), 1420 | r.rShiftTo(1, r)), 1421 | 0 < i.signum() ? setTimeout(h, 0) : (0 < o && r.lShiftTo(o, r), 1422 | setTimeout((function() { 1423 | e(r) 1424 | } 1425 | ), 0)) 1426 | }; 1427 | setTimeout(h, 10) 1428 | } 1429 | } 1430 | , 1431 | t.prototype.fromNumberAsync = function(e, i, r, s) { 1432 | if ("number" == typeof i) 1433 | if (e < 2) 1434 | this.fromInt(1); 1435 | else { 1436 | this.fromNumber(e, r), 1437 | this.testBit(e - 1) || this.bitwiseTo(t.ONE.shiftLeft(e - 1), n, this), 1438 | this.isEven() && this.dAddOffset(1, 0); 1439 | var o = this 1440 | , h = function() { 1441 | o.dAddOffset(2, 0), 1442 | o.bitLength() > e && o.subTo(t.ONE.shiftLeft(e - 1), o), 1443 | o.isProbablePrime(i) ? setTimeout((function() { 1444 | s() 1445 | } 1446 | ), 0) : setTimeout(h, 0) 1447 | }; 1448 | setTimeout(h, 0) 1449 | } 1450 | else { 1451 | var a = [] 1452 | , u = 7 & e; 1453 | a.length = 1 + (e >> 3), 1454 | i.nextBytes(a), 1455 | 0 < u ? a[0] &= (1 << u) - 1 : a[0] = 0, 1456 | this.fromString(a, 256) 1457 | } 1458 | } 1459 | , 1460 | t 1461 | }(), V = function() { 1462 | function t() {} 1463 | return t.prototype.convert = function(t) { 1464 | return t 1465 | } 1466 | , 1467 | t.prototype.revert = function(t) { 1468 | return t 1469 | } 1470 | , 1471 | t.prototype.mulTo = function(t, e, i) { 1472 | t.multiplyTo(e, i) 1473 | } 1474 | , 1475 | t.prototype.sqrTo = function(t, e) { 1476 | t.squareTo(e) 1477 | } 1478 | , 1479 | t 1480 | }(), I = function() { 1481 | function t(t) { 1482 | this.m = t 1483 | } 1484 | return t.prototype.convert = function(t) { 1485 | return t.s < 0 || 0 <= t.compareTo(this.m) ? t.mod(this.m) : t 1486 | } 1487 | , 1488 | t.prototype.revert = function(t) { 1489 | return t 1490 | } 1491 | , 1492 | t.prototype.reduce = function(t) { 1493 | t.divRemTo(this.m, null, t) 1494 | } 1495 | , 1496 | t.prototype.mulTo = function(t, e, i) { 1497 | t.multiplyTo(e, i), 1498 | this.reduce(i) 1499 | } 1500 | , 1501 | t.prototype.sqrTo = function(t, e) { 1502 | t.squareTo(e), 1503 | this.reduce(e) 1504 | } 1505 | , 1506 | t 1507 | }(), N = function() { 1508 | function t(t) { 1509 | this.m = t, 1510 | this.mp = t.invDigit(), 1511 | this.mpl = 32767 & this.mp, 1512 | this.mph = this.mp >> 15, 1513 | this.um = (1 << t.DB - 15) - 1, 1514 | this.mt2 = 2 * t.t 1515 | } 1516 | return t.prototype.convert = function(t) { 1517 | var e = M(); 1518 | return t.abs().dlShiftTo(this.m.t, e), 1519 | e.divRemTo(this.m, null, e), 1520 | t.s < 0 && 0 < e.compareTo(O.ZERO) && this.m.subTo(e, e), 1521 | e 1522 | } 1523 | , 1524 | t.prototype.revert = function(t) { 1525 | var e = M(); 1526 | return t.copyTo(e), 1527 | this.reduce(e), 1528 | e 1529 | } 1530 | , 1531 | t.prototype.reduce = function(t) { 1532 | for (; t.t <= this.mt2; ) 1533 | t[t.t++] = 0; 1534 | for (var e = 0; e < this.m.t; ++e) { 1535 | var i = 32767 & t[e] 1536 | , r = i * this.mpl + ((i * this.mph + (t[e] >> 15) * this.mpl & this.um) << 15) & t.DM; 1537 | for (t[i = e + this.m.t] += this.m.am(0, r, t, e, 0, this.m.t); t[i] >= t.DV; ) 1538 | t[i] -= t.DV, 1539 | t[++i]++ 1540 | } 1541 | t.clamp(), 1542 | t.drShiftTo(this.m.t, t), 1543 | 0 <= t.compareTo(this.m) && t.subTo(this.m, t) 1544 | } 1545 | , 1546 | t.prototype.mulTo = function(t, e, i) { 1547 | t.multiplyTo(e, i), 1548 | this.reduce(i) 1549 | } 1550 | , 1551 | t.prototype.sqrTo = function(t, e) { 1552 | t.squareTo(e), 1553 | this.reduce(e) 1554 | } 1555 | , 1556 | t 1557 | }(), P = function() { 1558 | function t(t) { 1559 | this.m = t, 1560 | this.r2 = M(), 1561 | this.q3 = M(), 1562 | O.ONE.dlShiftTo(2 * t.t, this.r2), 1563 | this.mu = this.r2.divide(t) 1564 | } 1565 | return t.prototype.convert = function(t) { 1566 | if (t.s < 0 || t.t > 2 * this.m.t) 1567 | return t.mod(this.m); 1568 | if (t.compareTo(this.m) < 0) 1569 | return t; 1570 | var e = M(); 1571 | return t.copyTo(e), 1572 | this.reduce(e), 1573 | e 1574 | } 1575 | , 1576 | t.prototype.revert = function(t) { 1577 | return t 1578 | } 1579 | , 1580 | t.prototype.reduce = function(t) { 1581 | for (t.drShiftTo(this.m.t - 1, this.r2), 1582 | t.t > this.m.t + 1 && (t.t = this.m.t + 1, 1583 | t.clamp()), 1584 | this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3), 1585 | this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); t.compareTo(this.r2) < 0; ) 1586 | t.dAddOffset(1, this.m.t + 1); 1587 | for (t.subTo(this.r2, t); 0 <= t.compareTo(this.m); ) 1588 | t.subTo(this.m, t) 1589 | } 1590 | , 1591 | t.prototype.mulTo = function(t, e, i) { 1592 | t.multiplyTo(e, i), 1593 | this.reduce(i) 1594 | } 1595 | , 1596 | t.prototype.sqrTo = function(t, e) { 1597 | t.squareTo(e), 1598 | this.reduce(e) 1599 | } 1600 | , 1601 | t 1602 | }(); 1603 | function M() { 1604 | return new O(null) 1605 | } 1606 | function q(t, e) { 1607 | return new O(t,e) 1608 | } 1609 | "Microsoft Internet Explorer" == navigator.appName ? (O.prototype.am = function(t, e, i, r, n, s) { 1610 | for (var o = 32767 & e, h = e >> 15; 0 <= --s; ) { 1611 | var a = 32767 & this[t] 1612 | , u = this[t++] >> 15 1613 | , c = h * a + u * o; 1614 | n = ((a = o * a + ((32767 & c) << 15) + i[r] + (1073741823 & n)) >>> 30) + (c >>> 15) + h * u + (n >>> 30), 1615 | i[r++] = 1073741823 & a 1616 | } 1617 | return n 1618 | } 1619 | , 1620 | w = 30) : "Netscape" != navigator.appName ? (O.prototype.am = function(t, e, i, r, n, s) { 1621 | for (; 0 <= --s; ) { 1622 | var o = e * this[t++] + i[r] + n; 1623 | n = Math.floor(o / 67108864), 1624 | i[r++] = 67108863 & o 1625 | } 1626 | return n 1627 | } 1628 | , 1629 | w = 26) : (O.prototype.am = function(t, e, i, r, n, s) { 1630 | for (var o = 16383 & e, h = e >> 14; 0 <= --s; ) { 1631 | var a = 16383 & this[t] 1632 | , u = this[t++] >> 14 1633 | , c = h * a + u * o; 1634 | n = ((a = o * a + ((16383 & c) << 14) + i[r] + n) >> 28) + (c >> 14) + h * u, 1635 | i[r++] = 268435455 & a 1636 | } 1637 | return n 1638 | } 1639 | , 1640 | w = 28), 1641 | O.prototype.DB = w, 1642 | O.prototype.DM = (1 << w) - 1, 1643 | O.prototype.DV = 1 << w, 1644 | O.prototype.FV = Math.pow(2, 52), 1645 | O.prototype.F1 = 52 - w, 1646 | O.prototype.F2 = 2 * w - 52; 1647 | var L, j, H = []; 1648 | for (L = "0".charCodeAt(0), 1649 | j = 0; j <= 9; ++j) 1650 | H[L++] = j; 1651 | for (L = "a".charCodeAt(0), 1652 | j = 10; j < 36; ++j) 1653 | H[L++] = j; 1654 | for (L = "A".charCodeAt(0), 1655 | j = 10; j < 36; ++j) 1656 | H[L++] = j; 1657 | function C(t, e) { 1658 | var i = H[t.charCodeAt(e)]; 1659 | return null == i ? -1 : i 1660 | } 1661 | function F(t) { 1662 | var e = M(); 1663 | return e.fromInt(t), 1664 | e 1665 | } 1666 | function U(t) { 1667 | var e, i = 1; 1668 | return 0 != (e = t >>> 16) && (t = e, 1669 | i += 16), 1670 | 0 != (e = t >> 8) && (t = e, 1671 | i += 8), 1672 | 0 != (e = t >> 4) && (t = e, 1673 | i += 4), 1674 | 0 != (e = t >> 2) && (t = e, 1675 | i += 2), 1676 | 0 != (e = t >> 1) && (t = e, 1677 | i += 1), 1678 | i 1679 | } 1680 | O.ZERO = F(0), 1681 | O.ONE = F(1); 1682 | var K, k, _ = function() { 1683 | function t() { 1684 | this.i = 0, 1685 | this.j = 0, 1686 | this.S = [] 1687 | } 1688 | return t.prototype.init = function(t) { 1689 | var e, i, r; 1690 | for (e = 0; e < 256; ++e) 1691 | this.S[e] = e; 1692 | for (e = i = 0; e < 256; ++e) 1693 | i = i + this.S[e] + t[e % t.length] & 255, 1694 | r = this.S[e], 1695 | this.S[e] = this.S[i], 1696 | this.S[i] = r; 1697 | this.i = 0, 1698 | this.j = 0 1699 | } 1700 | , 1701 | t.prototype.next = function() { 1702 | var t; 1703 | return this.i = this.i + 1 & 255, 1704 | this.j = this.j + this.S[this.i] & 255, 1705 | t = this.S[this.i], 1706 | this.S[this.i] = this.S[this.j], 1707 | this.S[this.j] = t, 1708 | this.S[t + this.S[this.i] & 255] 1709 | } 1710 | , 1711 | t 1712 | }(), z = 256, Z = null; 1713 | if (null == Z) { 1714 | Z = []; 1715 | var G = void (k = 0); 1716 | if (window.crypto && window.crypto.getRandomValues) { 1717 | var $ = new Uint32Array(256); 1718 | for (window.crypto.getRandomValues($), 1719 | G = 0; G < $.length; ++G) 1720 | Z[k++] = 255 & $[G] 1721 | } 1722 | var Y = function(t) { 1723 | if (this.count = this.count || 0, 1724 | 256 <= this.count || z <= k) 1725 | window.removeEventListener ? window.removeEventListener("mousemove", Y, !1) : window.detachEvent && window.detachEvent("onmousemove", Y); 1726 | else 1727 | try { 1728 | var e = t.x + t.y; 1729 | Z[k++] = 255 & e, 1730 | this.count += 1 1731 | } catch (t) {} 1732 | }; 1733 | window.addEventListener ? window.addEventListener("mousemove", Y, !1) : window.attachEvent && window.attachEvent("onmousemove", Y) 1734 | } 1735 | function J() { 1736 | if (null == K) { 1737 | for (K = new _; k < z; ) { 1738 | var t = Math.floor(65536 * Math.random()); 1739 | Z[k++] = 255 & t 1740 | } 1741 | for (K.init(Z), 1742 | k = 0; k < Z.length; ++k) 1743 | Z[k] = 0; 1744 | k = 0 1745 | } 1746 | return K.next() 1747 | } 1748 | var X = function() { 1749 | function t() {} 1750 | return t.prototype.nextBytes = function(t) { 1751 | for (var e = 0; e < t.length; ++e) 1752 | t[e] = J() 1753 | } 1754 | , 1755 | t 1756 | }() 1757 | , Q = function() { 1758 | function t() { 1759 | this.n = null, 1760 | this.e = 0, 1761 | this.d = null, 1762 | this.p = null, 1763 | this.q = null, 1764 | this.dmp1 = null, 1765 | this.dmq1 = null, 1766 | this.coeff = null 1767 | } 1768 | return t.prototype.doPublic = function(t) { 1769 | return t.modPowInt(this.e, this.n) 1770 | } 1771 | , 1772 | t.prototype.doPrivate = function(t) { 1773 | if (null == this.p || null == this.q) 1774 | return t.modPow(this.d, this.n); 1775 | for (var e = t.mod(this.p).modPow(this.dmp1, this.p), i = t.mod(this.q).modPow(this.dmq1, this.q); e.compareTo(i) < 0; ) 1776 | e = e.add(this.p); 1777 | return e.subtract(i).multiply(this.coeff).mod(this.p).multiply(this.q).add(i) 1778 | } 1779 | , 1780 | t.prototype.setPublic = function(t, e) { 1781 | null != t && null != e && 0 < t.length && 0 < e.length ? (this.n = q(t, 16), 1782 | this.e = parseInt(e, 16)) : console.error("Invalid RSA public key") 1783 | } 1784 | , 1785 | t.prototype.encrypt = function(t) { 1786 | var e = function(t, e) { 1787 | if (e < t.length + 11) 1788 | return console.error("Message too long for RSA"), 1789 | null; 1790 | for (var i = [], r = t.length - 1; 0 <= r && 0 < e; ) { 1791 | var n = t.charCodeAt(r--); 1792 | n < 128 ? i[--e] = n : 127 < n && n < 2048 ? (i[--e] = 63 & n | 128, 1793 | i[--e] = n >> 6 | 192) : (i[--e] = 63 & n | 128, 1794 | i[--e] = n >> 6 & 63 | 128, 1795 | i[--e] = n >> 12 | 224) 1796 | } 1797 | i[--e] = 0; 1798 | for (var s = new X, o = []; 2 < e; ) { 1799 | for (o[0] = 0; 0 == o[0]; ) 1800 | s.nextBytes(o); 1801 | i[--e] = o[0] 1802 | } 1803 | return i[--e] = 2, 1804 | i[--e] = 0, 1805 | new O(i) 1806 | }(t, this.n.bitLength() + 7 >> 3); 1807 | if (null == e) 1808 | return null; 1809 | var i = this.doPublic(e); 1810 | if (null == i) 1811 | return null; 1812 | var r = i.toString(16); 1813 | return 0 == (1 & r.length) ? r : "0" + r 1814 | } 1815 | , 1816 | t.prototype.setPrivate = function(t, e, i) { 1817 | null != t && null != e && 0 < t.length && 0 < e.length ? (this.n = q(t, 16), 1818 | this.e = parseInt(e, 16), 1819 | this.d = q(i, 16)) : console.error("Invalid RSA private key") 1820 | } 1821 | , 1822 | t.prototype.setPrivateEx = function(t, e, i, r, n, s, o, h) { 1823 | null != t && null != e && 0 < t.length && 0 < e.length ? (this.n = q(t, 16), 1824 | this.e = parseInt(e, 16), 1825 | this.d = q(i, 16), 1826 | this.p = q(r, 16), 1827 | this.q = q(n, 16), 1828 | this.dmp1 = q(s, 16), 1829 | this.dmq1 = q(o, 16), 1830 | this.coeff = q(h, 16)) : console.error("Invalid RSA private key") 1831 | } 1832 | , 1833 | t.prototype.generate = function(t, e) { 1834 | var i = new X 1835 | , r = t >> 1; 1836 | this.e = parseInt(e, 16); 1837 | for (var n = new O(e,16); ; ) { 1838 | for (; this.p = new O(t - r,1,i), 1839 | 0 != this.p.subtract(O.ONE).gcd(n).compareTo(O.ONE) || !this.p.isProbablePrime(10); ) 1840 | ; 1841 | for (; this.q = new O(r,1,i), 1842 | 0 != this.q.subtract(O.ONE).gcd(n).compareTo(O.ONE) || !this.q.isProbablePrime(10); ) 1843 | ; 1844 | if (this.p.compareTo(this.q) <= 0) { 1845 | var s = this.p; 1846 | this.p = this.q, 1847 | this.q = s 1848 | } 1849 | var o = this.p.subtract(O.ONE) 1850 | , h = this.q.subtract(O.ONE) 1851 | , a = o.multiply(h); 1852 | if (0 == a.gcd(n).compareTo(O.ONE)) { 1853 | this.n = this.p.multiply(this.q), 1854 | this.d = n.modInverse(a), 1855 | this.dmp1 = this.d.mod(o), 1856 | this.dmq1 = this.d.mod(h), 1857 | this.coeff = this.q.modInverse(this.p); 1858 | break 1859 | } 1860 | } 1861 | } 1862 | , 1863 | t.prototype.decrypt = function(t) { 1864 | var e = q(t, 16) 1865 | , i = this.doPrivate(e); 1866 | return null == i ? null : function(t, e) { 1867 | for (var i = t.toByteArray(), r = 0; r < i.length && 0 == i[r]; ) 1868 | ++r; 1869 | if (i.length - r != e - 1 || 2 != i[r]) 1870 | return null; 1871 | for (++r; 0 != i[r]; ) 1872 | if (++r >= i.length) 1873 | return null; 1874 | for (var n = ""; ++r < i.length; ) { 1875 | var s = 255 & i[r]; 1876 | s < 128 ? n += String.fromCharCode(s) : 191 < s && s < 224 ? (n += String.fromCharCode((31 & s) << 6 | 63 & i[r + 1]), 1877 | ++r) : (n += String.fromCharCode((15 & s) << 12 | (63 & i[r + 1]) << 6 | 63 & i[r + 2]), 1878 | r += 2) 1879 | } 1880 | return n 1881 | }(i, this.n.bitLength() + 7 >> 3) 1882 | } 1883 | , 1884 | t.prototype.generateAsync = function(t, e, i) { 1885 | var r = new X 1886 | , n = t >> 1; 1887 | this.e = parseInt(e, 16); 1888 | var s = new O(e,16) 1889 | , o = this 1890 | , h = function() { 1891 | var e = function() { 1892 | if (o.p.compareTo(o.q) <= 0) { 1893 | var t = o.p; 1894 | o.p = o.q, 1895 | o.q = t 1896 | } 1897 | var e = o.p.subtract(O.ONE) 1898 | , r = o.q.subtract(O.ONE) 1899 | , n = e.multiply(r); 1900 | 0 == n.gcd(s).compareTo(O.ONE) ? (o.n = o.p.multiply(o.q), 1901 | o.d = s.modInverse(n), 1902 | o.dmp1 = o.d.mod(e), 1903 | o.dmq1 = o.d.mod(r), 1904 | o.coeff = o.q.modInverse(o.p), 1905 | setTimeout((function() { 1906 | i() 1907 | } 1908 | ), 0)) : setTimeout(h, 0) 1909 | } 1910 | , a = function() { 1911 | o.q = M(), 1912 | o.q.fromNumberAsync(n, 1, r, (function() { 1913 | o.q.subtract(O.ONE).gcda(s, (function(t) { 1914 | 0 == t.compareTo(O.ONE) && o.q.isProbablePrime(10) ? setTimeout(e, 0) : setTimeout(a, 0) 1915 | } 1916 | )) 1917 | } 1918 | )) 1919 | } 1920 | , u = function() { 1921 | o.p = M(), 1922 | o.p.fromNumberAsync(t - n, 1, r, (function() { 1923 | o.p.subtract(O.ONE).gcda(s, (function(t) { 1924 | 0 == t.compareTo(O.ONE) && o.p.isProbablePrime(10) ? setTimeout(a, 0) : setTimeout(u, 0) 1925 | } 1926 | )) 1927 | } 1928 | )) 1929 | }; 1930 | setTimeout(u, 0) 1931 | }; 1932 | setTimeout(h, 0) 1933 | } 1934 | , 1935 | t.prototype.sign = function(t, e, i) { 1936 | var r = function(t, e) { 1937 | if (e < t.length + 22) 1938 | return console.error("Message too long for RSA"), 1939 | null; 1940 | for (var i = e - t.length - 6, r = "", n = 0; n < i; n += 2) 1941 | r += "ff"; 1942 | return q("0001" + r + "00" + t, 16) 1943 | }((W[i] || "") + e(t).toString(), this.n.bitLength() / 4); 1944 | if (null == r) 1945 | return null; 1946 | var n = this.doPrivate(r); 1947 | if (null == n) 1948 | return null; 1949 | var s = n.toString(16); 1950 | return 0 == (1 & s.length) ? s : "0" + s 1951 | } 1952 | , 1953 | t.prototype.verify = function(t, e, i) { 1954 | var r = q(e, 16) 1955 | , n = this.doPublic(r); 1956 | return null == n ? null : function(t) { 1957 | for (var e in W) 1958 | if (W.hasOwnProperty(e)) { 1959 | var i = W[e] 1960 | , r = i.length; 1961 | if (t.substr(0, r) == i) 1962 | return t.substr(r) 1963 | } 1964 | return t 1965 | }(n.toString(16).replace(/^1f+00/, "")) == i(t).toString() 1966 | } 1967 | , 1968 | t 1969 | }() 1970 | , W = { 1971 | md2: "3020300c06082a864886f70d020205000410", 1972 | md5: "3020300c06082a864886f70d020505000410", 1973 | sha1: "3021300906052b0e03021a05000414", 1974 | sha224: "302d300d06096086480165030402040500041c", 1975 | sha256: "3031300d060960864801650304020105000420", 1976 | sha384: "3041300d060960864801650304020205000430", 1977 | sha512: "3051300d060960864801650304020305000440", 1978 | ripemd160: "3021300906052b2403020105000414" 1979 | } 1980 | , tt = {}; 1981 | tt.lang = { 1982 | extend: function(t, e, i) { 1983 | if (!e || !t) 1984 | throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included."); 1985 | var r = function() {}; 1986 | if (r.prototype = e.prototype, 1987 | t.prototype = new r, 1988 | (t.prototype.constructor = t).superclass = e.prototype, 1989 | e.prototype.constructor == Object.prototype.constructor && (e.prototype.constructor = e), 1990 | i) { 1991 | var n; 1992 | for (n in i) 1993 | t.prototype[n] = i[n]; 1994 | var s = function() {} 1995 | , o = ["toString", "valueOf"]; 1996 | try { 1997 | /MSIE/.test(navigator.userAgent) && (s = function(t, e) { 1998 | for (n = 0; n < o.length; n += 1) { 1999 | var i = o[n] 2000 | , r = e[i]; 2001 | "function" == typeof r && r != Object.prototype[i] && (t[i] = r) 2002 | } 2003 | } 2004 | ) 2005 | } catch (t) {} 2006 | s(t.prototype, i) 2007 | } 2008 | } 2009 | }; 2010 | var et = {}; 2011 | void 0 !== et.asn1 && et.asn1 || (et.asn1 = {}), 2012 | et.asn1.ASN1Util = new function() { 2013 | this.integerToByteHex = function(t) { 2014 | var e = t.toString(16); 2015 | return e.length % 2 == 1 && (e = "0" + e), 2016 | e 2017 | } 2018 | , 2019 | this.bigIntToMinTwosComplementsHex = function(t) { 2020 | var e = t.toString(16); 2021 | if ("-" != e.substr(0, 1)) 2022 | e.length % 2 == 1 ? e = "0" + e : e.match(/^[0-7]/) || (e = "00" + e); 2023 | else { 2024 | var i = e.substr(1).length; 2025 | i % 2 == 1 ? i += 1 : e.match(/^[0-7]/) || (i += 2); 2026 | for (var r = "", n = 0; n < i; n++) 2027 | r += "f"; 2028 | e = new O(r,16).xor(t).add(O.ONE).toString(16).replace(/^-/, "") 2029 | } 2030 | return e 2031 | } 2032 | , 2033 | this.getPEMStringFromHex = function(t, e) { 2034 | return hextopem(t, e) 2035 | } 2036 | , 2037 | this.newObject = function(t) { 2038 | var e = et.asn1 2039 | , i = e.DERBoolean 2040 | , r = e.DERInteger 2041 | , n = e.DERBitString 2042 | , s = e.DEROctetString 2043 | , o = e.DERNull 2044 | , h = e.DERObjectIdentifier 2045 | , a = e.DEREnumerated 2046 | , u = e.DERUTF8String 2047 | , c = e.DERNumericString 2048 | , f = e.DERPrintableString 2049 | , l = e.DERTeletexString 2050 | , p = e.DERIA5String 2051 | , g = e.DERUTCTime 2052 | , d = e.DERGeneralizedTime 2053 | , v = e.DERSequence 2054 | , m = e.DERSet 2055 | , y = e.DERTaggedObject 2056 | , b = e.ASN1Util.newObject 2057 | , T = Object.keys(t); 2058 | if (1 != T.length) 2059 | throw "key of param shall be only one."; 2060 | var S = T[0]; 2061 | if (-1 == ":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":" + S + ":")) 2062 | throw "undefined key: " + S; 2063 | if ("bool" == S) 2064 | return new i(t[S]); 2065 | if ("int" == S) 2066 | return new r(t[S]); 2067 | if ("bitstr" == S) 2068 | return new n(t[S]); 2069 | if ("octstr" == S) 2070 | return new s(t[S]); 2071 | if ("null" == S) 2072 | return new o(t[S]); 2073 | if ("oid" == S) 2074 | return new h(t[S]); 2075 | if ("enum" == S) 2076 | return new a(t[S]); 2077 | if ("utf8str" == S) 2078 | return new u(t[S]); 2079 | if ("numstr" == S) 2080 | return new c(t[S]); 2081 | if ("prnstr" == S) 2082 | return new f(t[S]); 2083 | if ("telstr" == S) 2084 | return new l(t[S]); 2085 | if ("ia5str" == S) 2086 | return new p(t[S]); 2087 | if ("utctime" == S) 2088 | return new g(t[S]); 2089 | if ("gentime" == S) 2090 | return new d(t[S]); 2091 | if ("seq" == S) { 2092 | for (var E = t[S], w = [], D = 0; D < E.length; D++) { 2093 | var x = b(E[D]); 2094 | w.push(x) 2095 | } 2096 | return new v({ 2097 | array: w 2098 | }) 2099 | } 2100 | if ("set" == S) { 2101 | for (E = t[S], 2102 | w = [], 2103 | D = 0; D < E.length; D++) 2104 | x = b(E[D]), 2105 | w.push(x); 2106 | return new m({ 2107 | array: w 2108 | }) 2109 | } 2110 | if ("tag" == S) { 2111 | var R = t[S]; 2112 | if ("[object Array]" === Object.prototype.toString.call(R) && 3 == R.length) { 2113 | var B = b(R[2]); 2114 | return new y({ 2115 | tag: R[0], 2116 | explicit: R[1], 2117 | obj: B 2118 | }) 2119 | } 2120 | var A = {}; 2121 | if (void 0 !== R.explicit && (A.explicit = R.explicit), 2122 | void 0 !== R.tag && (A.tag = R.tag), 2123 | void 0 === R.obj) 2124 | throw "obj shall be specified for 'tag'."; 2125 | return A.obj = b(R.obj), 2126 | new y(A) 2127 | } 2128 | } 2129 | , 2130 | this.jsonToASN1HEX = function(t) { 2131 | return this.newObject(t).getEncodedHex() 2132 | } 2133 | } 2134 | , 2135 | et.asn1.ASN1Util.oidHexToInt = function(t) { 2136 | for (var e = "", i = parseInt(t.substr(0, 2), 16), r = (e = Math.floor(i / 40) + "." + i % 40, 2137 | ""), n = 2; n < t.length; n += 2) { 2138 | var s = ("00000000" + parseInt(t.substr(n, 2), 16).toString(2)).slice(-8); 2139 | r += s.substr(1, 7), 2140 | "0" == s.substr(0, 1) && (e = e + "." + new O(r,2).toString(10), 2141 | r = "") 2142 | } 2143 | return e 2144 | } 2145 | , 2146 | et.asn1.ASN1Util.oidIntToHex = function(t) { 2147 | var e = function(t) { 2148 | var e = t.toString(16); 2149 | return 1 == e.length && (e = "0" + e), 2150 | e 2151 | } 2152 | , i = function(t) { 2153 | var i = "" 2154 | , r = new O(t,10).toString(2) 2155 | , n = 7 - r.length % 7; 2156 | 7 == n && (n = 0); 2157 | for (var s = "", o = 0; o < n; o++) 2158 | s += "0"; 2159 | for (r = s + r, 2160 | o = 0; o < r.length - 1; o += 7) { 2161 | var h = r.substr(o, 7); 2162 | o != r.length - 7 && (h = "1" + h), 2163 | i += e(parseInt(h, 2)) 2164 | } 2165 | return i 2166 | }; 2167 | if (!t.match(/^[0-9.]+$/)) 2168 | throw "malformed oid string: " + t; 2169 | var r = "" 2170 | , n = t.split(".") 2171 | , s = 40 * parseInt(n[0]) + parseInt(n[1]); 2172 | r += e(s), 2173 | n.splice(0, 2); 2174 | for (var o = 0; o < n.length; o++) 2175 | r += i(n[o]); 2176 | return r 2177 | } 2178 | , 2179 | et.asn1.ASN1Object = function() { 2180 | this.getLengthHexFromValue = function() { 2181 | if (void 0 === this.hV || null == this.hV) 2182 | throw "this.hV is null or undefined."; 2183 | if (this.hV.length % 2 == 1) 2184 | throw "value hex must be even length: n=" + "".length + ",v=" + this.hV; 2185 | var t = this.hV.length / 2 2186 | , e = t.toString(16); 2187 | if (e.length % 2 == 1 && (e = "0" + e), 2188 | t < 128) 2189 | return e; 2190 | var i = e.length / 2; 2191 | if (15 < i) 2192 | throw "ASN.1 length too long to represent by 8x: n = " + t.toString(16); 2193 | return (128 + i).toString(16) + e 2194 | } 2195 | , 2196 | this.getEncodedHex = function() { 2197 | return (null == this.hTLV || this.isModified) && (this.hV = this.getFreshValueHex(), 2198 | this.hL = this.getLengthHexFromValue(), 2199 | this.hTLV = this.hT + this.hL + this.hV, 2200 | this.isModified = !1), 2201 | this.hTLV 2202 | } 2203 | , 2204 | this.getValueHex = function() { 2205 | return this.getEncodedHex(), 2206 | this.hV 2207 | } 2208 | , 2209 | this.getFreshValueHex = function() { 2210 | return "" 2211 | } 2212 | } 2213 | , 2214 | et.asn1.DERAbstractString = function(t) { 2215 | et.asn1.DERAbstractString.superclass.constructor.call(this), 2216 | this.getString = function() { 2217 | return this.s 2218 | } 2219 | , 2220 | this.setString = function(t) { 2221 | this.hTLV = null, 2222 | this.isModified = !0, 2223 | this.s = t, 2224 | this.hV = stohex(this.s) 2225 | } 2226 | , 2227 | this.setStringHex = function(t) { 2228 | this.hTLV = null, 2229 | this.isModified = !0, 2230 | this.s = null, 2231 | this.hV = t 2232 | } 2233 | , 2234 | this.getFreshValueHex = function() { 2235 | return this.hV 2236 | } 2237 | , 2238 | void 0 !== t && ("string" == typeof t ? this.setString(t) : void 0 !== t.str ? this.setString(t.str) : void 0 !== t.hex && this.setStringHex(t.hex)) 2239 | } 2240 | , 2241 | tt.lang.extend(et.asn1.DERAbstractString, et.asn1.ASN1Object), 2242 | et.asn1.DERAbstractTime = function(t) { 2243 | et.asn1.DERAbstractTime.superclass.constructor.call(this), 2244 | this.localDateToUTC = function(t) { 2245 | return new Date(t.getTime() + 6e4 * t.getTimezoneOffset()) 2246 | // return utc = t.getTime() + 6e4 * t.getTimezoneOffset(), 2247 | // new Date(utc) 2248 | } 2249 | , 2250 | this.formatDate = function(t, e, i) { 2251 | var r = this.zeroPadding 2252 | , n = this.localDateToUTC(t) 2253 | , s = String(n.getFullYear()); 2254 | "utc" == e && (s = s.substr(2, 2)); 2255 | var o = s + r(String(n.getMonth() + 1), 2) + r(String(n.getDate()), 2) + r(String(n.getHours()), 2) + r(String(n.getMinutes()), 2) + r(String(n.getSeconds()), 2); 2256 | if (!0 === i) { 2257 | var h = n.getMilliseconds(); 2258 | if (0 != h) { 2259 | var a = r(String(h), 3); 2260 | o = o + "." + (a = a.replace(/[0]+$/, "")) 2261 | } 2262 | } 2263 | return o + "Z" 2264 | } 2265 | , 2266 | this.zeroPadding = function(t, e) { 2267 | return t.length >= e ? t : new Array(e - t.length + 1).join("0") + t 2268 | } 2269 | , 2270 | this.getString = function() { 2271 | return this.s 2272 | } 2273 | , 2274 | this.setString = function(t) { 2275 | this.hTLV = null, 2276 | this.isModified = !0, 2277 | this.s = t, 2278 | this.hV = stohex(t) 2279 | } 2280 | , 2281 | this.setByDateValue = function(t, e, i, r, n, s) { 2282 | var o = new Date(Date.UTC(t, e - 1, i, r, n, s, 0)); 2283 | this.setByDate(o) 2284 | } 2285 | , 2286 | this.getFreshValueHex = function() { 2287 | return this.hV 2288 | } 2289 | } 2290 | , 2291 | tt.lang.extend(et.asn1.DERAbstractTime, et.asn1.ASN1Object), 2292 | et.asn1.DERAbstractStructured = function(t) { 2293 | et.asn1.DERAbstractString.superclass.constructor.call(this), 2294 | this.setByASN1ObjectArray = function(t) { 2295 | this.hTLV = null, 2296 | this.isModified = !0, 2297 | this.asn1Array = t 2298 | } 2299 | , 2300 | this.appendASN1Object = function(t) { 2301 | this.hTLV = null, 2302 | this.isModified = !0, 2303 | this.asn1Array.push(t) 2304 | } 2305 | , 2306 | this.asn1Array = new Array, 2307 | void 0 !== t && void 0 !== t.array && (this.asn1Array = t.array) 2308 | } 2309 | , 2310 | tt.lang.extend(et.asn1.DERAbstractStructured, et.asn1.ASN1Object), 2311 | et.asn1.DERBoolean = function() { 2312 | et.asn1.DERBoolean.superclass.constructor.call(this), 2313 | this.hT = "01", 2314 | this.hTLV = "0101ff" 2315 | } 2316 | , 2317 | tt.lang.extend(et.asn1.DERBoolean, et.asn1.ASN1Object), 2318 | et.asn1.DERInteger = function(t) { 2319 | et.asn1.DERInteger.superclass.constructor.call(this), 2320 | this.hT = "02", 2321 | this.setByBigInteger = function(t) { 2322 | this.hTLV = null, 2323 | this.isModified = !0, 2324 | this.hV = et.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t) 2325 | } 2326 | , 2327 | this.setByInteger = function(t) { 2328 | var e = new O(String(t),10); 2329 | this.setByBigInteger(e) 2330 | } 2331 | , 2332 | this.setValueHex = function(t) { 2333 | this.hV = t 2334 | } 2335 | , 2336 | this.getFreshValueHex = function() { 2337 | return this.hV 2338 | } 2339 | , 2340 | void 0 !== t && (void 0 !== t.bigint ? this.setByBigInteger(t.bigint) : void 0 !== t.int ? this.setByInteger(t.int) : "number" == typeof t ? this.setByInteger(t) : void 0 !== t.hex && this.setValueHex(t.hex)) 2341 | } 2342 | , 2343 | tt.lang.extend(et.asn1.DERInteger, et.asn1.ASN1Object), 2344 | et.asn1.DERBitString = function(t) { 2345 | if (void 0 !== t && void 0 !== t.obj) { 2346 | var e = et.asn1.ASN1Util.newObject(t.obj); 2347 | t.hex = "00" + e.getEncodedHex() 2348 | } 2349 | et.asn1.DERBitString.superclass.constructor.call(this), 2350 | this.hT = "03", 2351 | this.setHexValueIncludingUnusedBits = function(t) { 2352 | this.hTLV = null, 2353 | this.isModified = !0, 2354 | this.hV = t 2355 | } 2356 | , 2357 | this.setUnusedBitsAndHexValue = function(t, e) { 2358 | if (t < 0 || 7 < t) 2359 | throw "unused bits shall be from 0 to 7: u = " + t; 2360 | var i = "0" + t; 2361 | this.hTLV = null, 2362 | this.isModified = !0, 2363 | this.hV = i + e 2364 | } 2365 | , 2366 | this.setByBinaryString = function(t) { 2367 | var e = 8 - (t = t.replace(/0+$/, "")).length % 8; 2368 | 8 == e && (e = 0); 2369 | for (var i = 0; i <= e; i++) 2370 | t += "0"; 2371 | var r = ""; 2372 | for (i = 0; i < t.length - 1; i += 8) { 2373 | var n = t.substr(i, 8) 2374 | , s = parseInt(n, 2).toString(16); 2375 | 1 == s.length && (s = "0" + s), 2376 | r += s 2377 | } 2378 | this.hTLV = null, 2379 | this.isModified = !0, 2380 | this.hV = "0" + e + r 2381 | } 2382 | , 2383 | this.setByBooleanArray = function(t) { 2384 | for (var e = "", i = 0; i < t.length; i++) 2385 | 1 == t[i] ? e += "1" : e += "0"; 2386 | this.setByBinaryString(e) 2387 | } 2388 | , 2389 | this.newFalseArray = function(t) { 2390 | for (var e = new Array(t), i = 0; i < t; i++) 2391 | e[i] = !1; 2392 | return e 2393 | } 2394 | , 2395 | this.getFreshValueHex = function() { 2396 | return this.hV 2397 | } 2398 | , 2399 | void 0 !== t && ("string" == typeof t && t.toLowerCase().match(/^[0-9a-f]+$/) ? this.setHexValueIncludingUnusedBits(t) : void 0 !== t.hex ? this.setHexValueIncludingUnusedBits(t.hex) : void 0 !== t.bin ? this.setByBinaryString(t.bin) : void 0 !== t.array && this.setByBooleanArray(t.array)) 2400 | } 2401 | , 2402 | tt.lang.extend(et.asn1.DERBitString, et.asn1.ASN1Object), 2403 | et.asn1.DEROctetString = function(t) { 2404 | if (void 0 !== t && void 0 !== t.obj) { 2405 | var e = et.asn1.ASN1Util.newObject(t.obj); 2406 | t.hex = e.getEncodedHex() 2407 | } 2408 | et.asn1.DEROctetString.superclass.constructor.call(this, t), 2409 | this.hT = "04" 2410 | } 2411 | , 2412 | tt.lang.extend(et.asn1.DEROctetString, et.asn1.DERAbstractString), 2413 | et.asn1.DERNull = function() { 2414 | et.asn1.DERNull.superclass.constructor.call(this), 2415 | this.hT = "05", 2416 | this.hTLV = "0500" 2417 | } 2418 | , 2419 | tt.lang.extend(et.asn1.DERNull, et.asn1.ASN1Object), 2420 | et.asn1.DERObjectIdentifier = function(t) { 2421 | var e = function(t) { 2422 | var e = t.toString(16); 2423 | return 1 == e.length && (e = "0" + e), 2424 | e 2425 | } 2426 | , i = function(t) { 2427 | var i = "" 2428 | , r = new O(t,10).toString(2) 2429 | , n = 7 - r.length % 7; 2430 | 7 == n && (n = 0); 2431 | for (var s = "", o = 0; o < n; o++) 2432 | s += "0"; 2433 | for (r = s + r, 2434 | o = 0; o < r.length - 1; o += 7) { 2435 | var h = r.substr(o, 7); 2436 | o != r.length - 7 && (h = "1" + h), 2437 | i += e(parseInt(h, 2)) 2438 | } 2439 | return i 2440 | }; 2441 | et.asn1.DERObjectIdentifier.superclass.constructor.call(this), 2442 | this.hT = "06", 2443 | this.setValueHex = function(t) { 2444 | this.hTLV = null, 2445 | this.isModified = !0, 2446 | this.s = null, 2447 | this.hV = t 2448 | } 2449 | , 2450 | this.setValueOidString = function(t) { 2451 | if (!t.match(/^[0-9.]+$/)) 2452 | throw "malformed oid string: " + t; 2453 | var r = "" 2454 | , n = t.split(".") 2455 | , s = 40 * parseInt(n[0]) + parseInt(n[1]); 2456 | r += e(s), 2457 | n.splice(0, 2); 2458 | for (var o = 0; o < n.length; o++) 2459 | r += i(n[o]); 2460 | this.hTLV = null, 2461 | this.isModified = !0, 2462 | this.s = null, 2463 | this.hV = r 2464 | } 2465 | , 2466 | this.setValueName = function(t) { 2467 | var e = et.asn1.x509.OID.name2oid(t); 2468 | if ("" === e) 2469 | throw "DERObjectIdentifier oidName undefined: " + t; 2470 | this.setValueOidString(e) 2471 | } 2472 | , 2473 | this.getFreshValueHex = function() { 2474 | return this.hV 2475 | } 2476 | , 2477 | void 0 !== t && ("string" == typeof t ? t.match(/^[0-2].[0-9.]+$/) ? this.setValueOidString(t) : this.setValueName(t) : void 0 !== t.oid ? this.setValueOidString(t.oid) : void 0 !== t.hex ? this.setValueHex(t.hex) : void 0 !== t.name && this.setValueName(t.name)) 2478 | } 2479 | , 2480 | tt.lang.extend(et.asn1.DERObjectIdentifier, et.asn1.ASN1Object), 2481 | et.asn1.DEREnumerated = function(t) { 2482 | et.asn1.DEREnumerated.superclass.constructor.call(this), 2483 | this.hT = "0a", 2484 | this.setByBigInteger = function(t) { 2485 | this.hTLV = null, 2486 | this.isModified = !0, 2487 | this.hV = et.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t) 2488 | } 2489 | , 2490 | this.setByInteger = function(t) { 2491 | var e = new O(String(t),10); 2492 | this.setByBigInteger(e) 2493 | } 2494 | , 2495 | this.setValueHex = function(t) { 2496 | this.hV = t 2497 | } 2498 | , 2499 | this.getFreshValueHex = function() { 2500 | return this.hV 2501 | } 2502 | , 2503 | void 0 !== t && (void 0 !== t.int ? this.setByInteger(t.int) : "number" == typeof t ? this.setByInteger(t) : void 0 !== t.hex && this.setValueHex(t.hex)) 2504 | } 2505 | , 2506 | tt.lang.extend(et.asn1.DEREnumerated, et.asn1.ASN1Object), 2507 | et.asn1.DERUTF8String = function(t) { 2508 | et.asn1.DERUTF8String.superclass.constructor.call(this, t), 2509 | this.hT = "0c" 2510 | } 2511 | , 2512 | tt.lang.extend(et.asn1.DERUTF8String, et.asn1.DERAbstractString), 2513 | et.asn1.DERNumericString = function(t) { 2514 | et.asn1.DERNumericString.superclass.constructor.call(this, t), 2515 | this.hT = "12" 2516 | } 2517 | , 2518 | tt.lang.extend(et.asn1.DERNumericString, et.asn1.DERAbstractString), 2519 | et.asn1.DERPrintableString = function(t) { 2520 | et.asn1.DERPrintableString.superclass.constructor.call(this, t), 2521 | this.hT = "13" 2522 | } 2523 | , 2524 | tt.lang.extend(et.asn1.DERPrintableString, et.asn1.DERAbstractString), 2525 | et.asn1.DERTeletexString = function(t) { 2526 | et.asn1.DERTeletexString.superclass.constructor.call(this, t), 2527 | this.hT = "14" 2528 | } 2529 | , 2530 | tt.lang.extend(et.asn1.DERTeletexString, et.asn1.DERAbstractString), 2531 | et.asn1.DERIA5String = function(t) { 2532 | et.asn1.DERIA5String.superclass.constructor.call(this, t), 2533 | this.hT = "16" 2534 | } 2535 | , 2536 | tt.lang.extend(et.asn1.DERIA5String, et.asn1.DERAbstractString), 2537 | et.asn1.DERUTCTime = function(t) { 2538 | et.asn1.DERUTCTime.superclass.constructor.call(this, t), 2539 | this.hT = "17", 2540 | this.setByDate = function(t) { 2541 | this.hTLV = null, 2542 | this.isModified = !0, 2543 | this.date = t, 2544 | this.s = this.formatDate(this.date, "utc"), 2545 | this.hV = stohex(this.s) 2546 | } 2547 | , 2548 | this.getFreshValueHex = function() { 2549 | return void 0 === this.date && void 0 === this.s && (this.date = new Date, 2550 | this.s = this.formatDate(this.date, "utc"), 2551 | this.hV = stohex(this.s)), 2552 | this.hV 2553 | } 2554 | , 2555 | void 0 !== t && (void 0 !== t.str ? this.setString(t.str) : "string" == typeof t && t.match(/^[0-9]{12}Z$/) ? this.setString(t) : void 0 !== t.hex ? this.setStringHex(t.hex) : void 0 !== t.date && this.setByDate(t.date)) 2556 | } 2557 | , 2558 | tt.lang.extend(et.asn1.DERUTCTime, et.asn1.DERAbstractTime), 2559 | et.asn1.DERGeneralizedTime = function(t) { 2560 | et.asn1.DERGeneralizedTime.superclass.constructor.call(this, t), 2561 | this.hT = "18", 2562 | this.withMillis = !1, 2563 | this.setByDate = function(t) { 2564 | this.hTLV = null, 2565 | this.isModified = !0, 2566 | this.date = t, 2567 | this.s = this.formatDate(this.date, "gen", this.withMillis), 2568 | this.hV = stohex(this.s) 2569 | } 2570 | , 2571 | this.getFreshValueHex = function() { 2572 | return void 0 === this.date && void 0 === this.s && (this.date = new Date, 2573 | this.s = this.formatDate(this.date, "gen", this.withMillis), 2574 | this.hV = stohex(this.s)), 2575 | this.hV 2576 | } 2577 | , 2578 | void 0 !== t && (void 0 !== t.str ? this.setString(t.str) : "string" == typeof t && t.match(/^[0-9]{14}Z$/) ? this.setString(t) : void 0 !== t.hex ? this.setStringHex(t.hex) : void 0 !== t.date && this.setByDate(t.date), 2579 | !0 === t.millis && (this.withMillis = !0)) 2580 | } 2581 | , 2582 | tt.lang.extend(et.asn1.DERGeneralizedTime, et.asn1.DERAbstractTime), 2583 | et.asn1.DERSequence = function(t) { 2584 | et.asn1.DERSequence.superclass.constructor.call(this, t), 2585 | this.hT = "30", 2586 | this.getFreshValueHex = function() { 2587 | for (var t = "", e = 0; e < this.asn1Array.length; e++) 2588 | t += this.asn1Array[e].getEncodedHex(); 2589 | return this.hV = t, 2590 | this.hV 2591 | } 2592 | } 2593 | , 2594 | tt.lang.extend(et.asn1.DERSequence, et.asn1.DERAbstractStructured), 2595 | et.asn1.DERSet = function(t) { 2596 | et.asn1.DERSet.superclass.constructor.call(this, t), 2597 | this.hT = "31", 2598 | this.sortFlag = !0, 2599 | this.getFreshValueHex = function() { 2600 | for (var t = new Array, e = 0; e < this.asn1Array.length; e++) { 2601 | var i = this.asn1Array[e]; 2602 | t.push(i.getEncodedHex()) 2603 | } 2604 | return 1 == this.sortFlag && t.sort(), 2605 | this.hV = t.join(""), 2606 | this.hV 2607 | } 2608 | , 2609 | void 0 !== t && void 0 !== t.sortflag && 0 == t.sortflag && (this.sortFlag = !1) 2610 | } 2611 | , 2612 | tt.lang.extend(et.asn1.DERSet, et.asn1.DERAbstractStructured), 2613 | et.asn1.DERTaggedObject = function(t) { 2614 | et.asn1.DERTaggedObject.superclass.constructor.call(this), 2615 | this.hT = "a0", 2616 | this.hV = "", 2617 | this.isExplicit = !0, 2618 | this.asn1Object = null, 2619 | this.setASN1Object = function(t, e, i) { 2620 | this.hT = e, 2621 | this.isExplicit = t, 2622 | this.asn1Object = i, 2623 | this.isExplicit ? (this.hV = this.asn1Object.getEncodedHex(), 2624 | this.hTLV = null, 2625 | this.isModified = !0) : (this.hV = null, 2626 | this.hTLV = i.getEncodedHex(), 2627 | this.hTLV = this.hTLV.replace(/^../, e), 2628 | this.isModified = !1) 2629 | } 2630 | , 2631 | this.getFreshValueHex = function() { 2632 | return this.hV 2633 | } 2634 | , 2635 | void 0 !== t && (void 0 !== t.tag && (this.hT = t.tag), 2636 | void 0 !== t.explicit && (this.isExplicit = t.explicit), 2637 | void 0 !== t.obj && (this.asn1Object = t.obj, 2638 | this.setASN1Object(this.isExplicit, this.hT, this.asn1Object))) 2639 | } 2640 | , 2641 | tt.lang.extend(et.asn1.DERTaggedObject, et.asn1.ASN1Object); 2642 | var it = function(t) { 2643 | function e(i) { 2644 | var r = t.call(this) || this; 2645 | return i && ("string" == typeof i ? r.parseKey(i) : (e.hasPrivateKeyProperty(i) || e.hasPublicKeyProperty(i)) && r.parsePropertiesFrom(i)), 2646 | r 2647 | } 2648 | return function(t, e) { 2649 | function i() { 2650 | this.constructor = t 2651 | } 2652 | g(t, e), 2653 | t.prototype = null === e ? Object.create(e) : (i.prototype = e.prototype, 2654 | new i) 2655 | }(e, t), 2656 | e.prototype.parseKey = function(t) { 2657 | try { 2658 | var e = 0 2659 | , i = 0 2660 | , r = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(t) ? d(t) : v.unarmor(t) 2661 | , n = x.decode(r); 2662 | if (3 === n.sub.length && (n = n.sub[2].sub[0]), 2663 | 9 === n.sub.length) { 2664 | e = n.sub[1].getHexStringValue(), 2665 | this.n = q(e, 16), 2666 | i = n.sub[2].getHexStringValue(), 2667 | this.e = parseInt(i, 16); 2668 | var s = n.sub[3].getHexStringValue(); 2669 | this.d = q(s, 16); 2670 | var o = n.sub[4].getHexStringValue(); 2671 | this.p = q(o, 16); 2672 | var h = n.sub[5].getHexStringValue(); 2673 | this.q = q(h, 16); 2674 | var a = n.sub[6].getHexStringValue(); 2675 | this.dmp1 = q(a, 16); 2676 | var u = n.sub[7].getHexStringValue(); 2677 | this.dmq1 = q(u, 16); 2678 | var c = n.sub[8].getHexStringValue(); 2679 | this.coeff = q(c, 16) 2680 | } else { 2681 | if (2 !== n.sub.length) 2682 | return !1; 2683 | var f = n.sub[1].sub[0]; 2684 | e = f.sub[0].getHexStringValue(), 2685 | this.n = q(e, 16), 2686 | i = f.sub[1].getHexStringValue(), 2687 | this.e = parseInt(i, 16) 2688 | } 2689 | return !0 2690 | } catch (t) { 2691 | return !1 2692 | } 2693 | } 2694 | , 2695 | e.prototype.getPrivateBaseKey = function() { 2696 | var t = { 2697 | array: [new et.asn1.DERInteger({ 2698 | int: 0 2699 | }), new et.asn1.DERInteger({ 2700 | bigint: this.n 2701 | }), new et.asn1.DERInteger({ 2702 | int: this.e 2703 | }), new et.asn1.DERInteger({ 2704 | bigint: this.d 2705 | }), new et.asn1.DERInteger({ 2706 | bigint: this.p 2707 | }), new et.asn1.DERInteger({ 2708 | bigint: this.q 2709 | }), new et.asn1.DERInteger({ 2710 | bigint: this.dmp1 2711 | }), new et.asn1.DERInteger({ 2712 | bigint: this.dmq1 2713 | }), new et.asn1.DERInteger({ 2714 | bigint: this.coeff 2715 | })] 2716 | }; 2717 | return new et.asn1.DERSequence(t).getEncodedHex() 2718 | } 2719 | , 2720 | e.prototype.getPrivateBaseKeyB64 = function() { 2721 | return c(this.getPrivateBaseKey()) 2722 | } 2723 | , 2724 | e.prototype.getPublicBaseKey = function() { 2725 | var t = new et.asn1.DERSequence({ 2726 | array: [new et.asn1.DERObjectIdentifier({ 2727 | oid: "1.2.840.113549.1.1.1" 2728 | }), new et.asn1.DERNull] 2729 | }) 2730 | , e = new et.asn1.DERSequence({ 2731 | array: [new et.asn1.DERInteger({ 2732 | bigint: this.n 2733 | }), new et.asn1.DERInteger({ 2734 | int: this.e 2735 | })] 2736 | }) 2737 | , i = new et.asn1.DERBitString({ 2738 | hex: "00" + e.getEncodedHex() 2739 | }); 2740 | return new et.asn1.DERSequence({ 2741 | array: [t, i] 2742 | }).getEncodedHex() 2743 | } 2744 | , 2745 | e.prototype.getPublicBaseKeyB64 = function() { 2746 | return c(this.getPublicBaseKey()) 2747 | } 2748 | , 2749 | e.wordwrap = function(t, e) { 2750 | if (!t) 2751 | return t; 2752 | var i = "(.{1," + (e = e || 64) + "})( +|$\n?)|(.{1," + e + "})"; 2753 | return t.match(RegExp(i, "g")).join("\n") 2754 | } 2755 | , 2756 | e.prototype.getPrivateKey = function() { 2757 | var t = "-----BEGIN RSA PRIVATE KEY-----\n"; 2758 | return t += e.wordwrap(this.getPrivateBaseKeyB64()) + "\n", 2759 | t + "-----END RSA PRIVATE KEY-----" 2760 | } 2761 | , 2762 | e.prototype.getPublicKey = function() { 2763 | var t = "-----BEGIN PUBLIC KEY-----\n"; 2764 | return t += e.wordwrap(this.getPublicBaseKeyB64()) + "\n", 2765 | t + "-----END PUBLIC KEY-----" 2766 | } 2767 | , 2768 | e.hasPublicKeyProperty = function(t) { 2769 | return (t = t || {}).hasOwnProperty("n") && t.hasOwnProperty("e") 2770 | } 2771 | , 2772 | e.hasPrivateKeyProperty = function(t) { 2773 | return (t = t || {}).hasOwnProperty("n") && t.hasOwnProperty("e") && t.hasOwnProperty("d") && t.hasOwnProperty("p") && t.hasOwnProperty("q") && t.hasOwnProperty("dmp1") && t.hasOwnProperty("dmq1") && t.hasOwnProperty("coeff") 2774 | } 2775 | , 2776 | e.prototype.parsePropertiesFrom = function(t) { 2777 | this.n = t.n, 2778 | this.e = t.e, 2779 | t.hasOwnProperty("d") && (this.d = t.d, 2780 | this.p = t.p, 2781 | this.q = t.q, 2782 | this.dmp1 = t.dmp1, 2783 | this.dmq1 = t.dmq1, 2784 | this.coeff = t.coeff) 2785 | } 2786 | , 2787 | e 2788 | }(Q) 2789 | , rt = function() { 2790 | function t(t) { 2791 | t = t || {}, 2792 | this.default_key_size = parseInt(t.default_key_size, 10) || 1024, 2793 | this.default_public_exponent = t.default_public_exponent || "010001", 2794 | this.log = t.log || !1, 2795 | this.key = null 2796 | } 2797 | return t.prototype.setKey = function(t) { 2798 | this.log && this.key && console.warn("A key was already set, overriding existing."), 2799 | this.key = new it(t) 2800 | } 2801 | , 2802 | t.prototype.setPrivateKey = function(t) { 2803 | this.setKey(t) 2804 | } 2805 | , 2806 | t.prototype.setPublicKey = function(t) { 2807 | this.setKey(t) 2808 | } 2809 | , 2810 | t.prototype.decrypt = function(t) { 2811 | try { 2812 | return this.getKey().decrypt(f(t)) 2813 | } catch (t) { 2814 | return !1 2815 | } 2816 | } 2817 | , 2818 | t.prototype.encrypt = function(t) { 2819 | try { 2820 | return c(this.getKey().encrypt(t)) 2821 | } catch (t) { 2822 | return !1 2823 | } 2824 | } 2825 | , 2826 | t.prototype.sign = function(t, e, i) { 2827 | try { 2828 | return c(this.getKey().sign(t, e, i)) 2829 | } catch (t) { 2830 | return !1 2831 | } 2832 | } 2833 | , 2834 | t.prototype.verify = function(t, e, i) { 2835 | try { 2836 | return this.getKey().verify(t, f(e), i) 2837 | } catch (t) { 2838 | return !1 2839 | } 2840 | } 2841 | , 2842 | t.prototype.getKey = function(t) { 2843 | if (!this.key) { 2844 | if (this.key = new it, 2845 | t && "[object Function]" === {}.toString.call(t)) 2846 | return void this.key.generateAsync(this.default_key_size, this.default_public_exponent, t); 2847 | this.key.generate(this.default_key_size, this.default_public_exponent) 2848 | } 2849 | return this.key 2850 | } 2851 | , 2852 | t.prototype.getPrivateKey = function() { 2853 | return this.getKey().getPrivateKey() 2854 | } 2855 | , 2856 | t.prototype.getPrivateKeyB64 = function() { 2857 | return this.getKey().getPrivateBaseKeyB64() 2858 | } 2859 | , 2860 | t.prototype.getPublicKey = function() { 2861 | return this.getKey().getPublicKey() 2862 | } 2863 | , 2864 | t.prototype.getPublicKeyB64 = function() { 2865 | return this.getKey().getPublicBaseKeyB64() 2866 | } 2867 | , 2868 | t.version = "3.0.0-rc.1", 2869 | t 2870 | }(); 2871 | window.JSEncrypt = rt; 2872 | } 2873 | fun("1") 2874 | function get_password(hash, public_key, password){ 2875 | s = new window.JSEncrypt; 2876 | s.setPublicKey(public_key); 2877 | pws = s.encrypt(hash + password); 2878 | return pws 2879 | } 2880 | --------------------------------------------------------------------------------