U.E.js 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. //#region 加密区域
  2. Namespace.register("U.E"); //加密
  3. /*
  4. 功能:前端加密函数,暂未使用
  5. */
  6. U.E.CryptoJS = function (s, p) {
  7. var m = {}, l = m.lib = {}, n = function () {
  8. }, r = l.Base = { extend: function (b) {
  9. n.prototype = this;
  10. var h = new n;
  11. b && h.mixIn(b);
  12. h.hasOwnProperty("init") || (h.init = function () {
  13. h.$super.init.apply(this, arguments)
  14. });
  15. h.init.prototype = h;
  16. h.$super = this;
  17. return h
  18. }, create: function () {
  19. var b = this.extend();
  20. b.init.apply(b, arguments);
  21. return b
  22. }, init: function () {
  23. }, mixIn: function (b) {
  24. for (var h in b)
  25. b.hasOwnProperty(h) && (this[h] = b[h]);
  26. b.hasOwnProperty("toString") && (this.toString = b.toString)
  27. }, clone: function () {
  28. return this.init.prototype.extend(this)
  29. }
  30. },
  31. q = l.WordArray = r.extend({ init: function (b, h) {
  32. b = this.words = b || [];
  33. this.sigBytes = h != p ? h : 4 * b.length
  34. }, toString: function (b) {
  35. return (b || t).stringify(this)
  36. }, concat: function (b) {
  37. var h = this.words, a = b.words, j = this.sigBytes;
  38. b = b.sigBytes;
  39. this.clamp();
  40. if (j % 4)
  41. for (var g = 0; g < b; g++)
  42. h[j + g >>> 2] |= (a[g >>> 2] >>> 24 - 8 * (g % 4) & 255) << 24 - 8 * ((j + g) % 4);
  43. else if (65535 < a.length)
  44. for (g = 0; g < b; g += 4)
  45. h[j + g >>> 2] = a[g >>> 2];
  46. else
  47. h.push.apply(h, a);
  48. this.sigBytes += b;
  49. return this
  50. }, clamp: function () {
  51. var b = this.words, h = this.sigBytes;
  52. b[h >>> 2] &= 4294967295 <<
  53. 32 - 8 * (h % 4);
  54. b.length = s.ceil(h / 4)
  55. }, clone: function () {
  56. var b = r.clone.call(this);
  57. b.words = this.words.slice(0);
  58. return b
  59. }, random: function (b) {
  60. for (var h = [], a = 0; a < b; a += 4)
  61. h.push(4294967296 * s.random() | 0);
  62. return new q.init(h, b)
  63. }
  64. }), v = m.enc = {}, t = v.Hex = { stringify: function (b) {
  65. var a = b.words;
  66. b = b.sigBytes;
  67. for (var g = [], j = 0; j < b; j++) {
  68. var k = a[j >>> 2] >>> 24 - 8 * (j % 4) & 255;
  69. g.push((k >>> 4).toString(16));
  70. g.push((k & 15).toString(16))
  71. }
  72. return g.join("")
  73. }, parse: function (b) {
  74. for (var a = b.length, g = [], j = 0; j < a; j += 2)
  75. g[j >>> 3] |= parseInt(b.substr(j,
  76. 2), 16) << 24 - 4 * (j % 8);
  77. return new q.init(g, a / 2)
  78. }
  79. }, a = v.Latin1 = { stringify: function (b) {
  80. var a = b.words;
  81. b = b.sigBytes;
  82. for (var g = [], j = 0; j < b; j++)
  83. g.push(String.fromCharCode(a[j >>> 2] >>> 24 - 8 * (j % 4) & 255));
  84. return g.join("")
  85. }, parse: function (b) {
  86. for (var a = b.length, g = [], j = 0; j < a; j++)
  87. g[j >>> 2] |= (b.charCodeAt(j) & 255) << 24 - 8 * (j % 4);
  88. return new q.init(g, a)
  89. }
  90. }, u = v.Utf8 = { stringify: function (b) {
  91. try {
  92. return decodeURIComponent(escape(a.stringify(b)))
  93. } catch (g) {
  94. throw Error("Malformed UTF-8 data");
  95. }
  96. }, parse: function (b) {
  97. return a.parse(unescape(encodeURIComponent(b)))
  98. }
  99. },
  100. g = l.BufferedBlockAlgorithm = r.extend({ reset: function () {
  101. this._data = new q.init;
  102. this._nDataBytes = 0
  103. }, _append: function (b) {
  104. "string" == typeof b && (b = u.parse(b));
  105. this._data.concat(b);
  106. this._nDataBytes += b.sigBytes
  107. }, _process: function (b) {
  108. var a = this._data, g = a.words, j = a.sigBytes, k = this.blockSize, m = j / (4 * k), m = b ? s.ceil(m) : s.max((m | 0) - this._minBufferSize, 0);
  109. b = m * k;
  110. j = s.min(4 * b, j);
  111. if (b) {
  112. for (var l = 0; l < b; l += k)
  113. this._doProcessBlock(g, l);
  114. l = g.splice(0, b);
  115. a.sigBytes -= j
  116. }
  117. return new q.init(l, j)
  118. }, clone: function () {
  119. var b = r.clone.call(this);
  120. b._data = this._data.clone();
  121. return b
  122. }, _minBufferSize: 0
  123. });
  124. l.Hasher = g.extend({ cfg: r.extend(), init: function (b) {
  125. this.cfg = this.cfg.extend(b);
  126. this.reset()
  127. }, reset: function () {
  128. g.reset.call(this);
  129. this._doReset()
  130. }, update: function (b) {
  131. this._append(b);
  132. this._process();
  133. return this
  134. }, finalize: function (b) {
  135. b && this._append(b);
  136. return this._doFinalize()
  137. }, blockSize: 16, _createHelper: function (b) {
  138. return function (a, g) {
  139. return (new b.init(g)).finalize(a)
  140. }
  141. }, _createHmacHelper: function (b) {
  142. return function (a, g) {
  143. return (new k.HMAC.init(b,
  144. g)).finalize(a)
  145. }
  146. }
  147. });
  148. var k = m.algo = {};
  149. return m
  150. } (Math);
  151. (function (s) {
  152. function p(a, k, b, h, l, j, m) {
  153. a = a + (k & b | ~k & h) + l + m;
  154. return (a << j | a >>> 32 - j) + k
  155. }
  156. function m(a, k, b, h, l, j, m) {
  157. a = a + (k & h | b & ~h) + l + m;
  158. return (a << j | a >>> 32 - j) + k
  159. }
  160. function l(a, k, b, h, l, j, m) {
  161. a = a + (k ^ b ^ h) + l + m;
  162. return (a << j | a >>> 32 - j) + k
  163. }
  164. function n(a, k, b, h, l, j, m) {
  165. a = a + (b ^ (k | ~h)) + l + m;
  166. return (a << j | a >>> 32 - j) + k
  167. }
  168. for (var r = U.E.CryptoJS, q = r.lib, v = q.WordArray, t = q.Hasher, q = r.algo, a = [], u = 0; 64 > u; u++)
  169. a[u] = 4294967296 * s.abs(s.sin(u + 1)) | 0;
  170. q = q.MD5 = t.extend({ _doReset: function () {
  171. this._hash = new v.init[1732584193, 4023233417, 2562383102, 271733878]
  172. },
  173. _doProcessBlock: function (g, k) {
  174. for (var b = 0; 16 > b; b++) {
  175. var h = k + b, w = g[h];
  176. g[h] = (w << 8 | w >>> 24) & 16711935 | (w << 24 | w >>> 8) & 4278255360
  177. }
  178. var b = this._hash.words, h = g[k + 0], w = g[k + 1], j = g[k + 2], q = g[k + 3], r = g[k + 4], s = g[k + 5], t = g[k + 6], u = g[k + 7], v = g[k + 8], x = g[k + 9], y = g[k + 10], z = g[k + 11], A = g[k + 12], B = g[k + 13], C = g[k + 14], D = g[k + 15], c = b[0], d = b[1], e = b[2], f = b[3], c = p(c, d, e, f, h, 7, a[0]), f = p(f, c, d, e, w, 12, a[1]), e = p(e, f, c, d, j, 17, a[2]), d = p(d, e, f, c, q, 22, a[3]), c = p(c, d, e, f, r, 7, a[4]), f = p(f, c, d, e, s, 12, a[5]), e = p(e, f, c, d, t, 17, a[6]), d = p(d, e, f, c, u, 22, a[7]),
  179. c = p(c, d, e, f, v, 7, a[8]), f = p(f, c, d, e, x, 12, a[9]), e = p(e, f, c, d, y, 17, a[10]), d = p(d, e, f, c, z, 22, a[11]), c = p(c, d, e, f, A, 7, a[12]), f = p(f, c, d, e, B, 12, a[13]), e = p(e, f, c, d, C, 17, a[14]), d = p(d, e, f, c, D, 22, a[15]), c = m(c, d, e, f, w, 5, a[16]), f = m(f, c, d, e, t, 9, a[17]), e = m(e, f, c, d, z, 14, a[18]), d = m(d, e, f, c, h, 20, a[19]), c = m(c, d, e, f, s, 5, a[20]), f = m(f, c, d, e, y, 9, a[21]), e = m(e, f, c, d, D, 14, a[22]), d = m(d, e, f, c, r, 20, a[23]), c = m(c, d, e, f, x, 5, a[24]), f = m(f, c, d, e, C, 9, a[25]), e = m(e, f, c, d, q, 14, a[26]), d = m(d, e, f, c, v, 20, a[27]), c = m(c, d, e, f, B, 5, a[28]), f = m(f, c,
  180. d, e, j, 9, a[29]), e = m(e, f, c, d, u, 14, a[30]), d = m(d, e, f, c, A, 20, a[31]), c = l(c, d, e, f, s, 4, a[32]), f = l(f, c, d, e, v, 11, a[33]), e = l(e, f, c, d, z, 16, a[34]), d = l(d, e, f, c, C, 23, a[35]), c = l(c, d, e, f, w, 4, a[36]), f = l(f, c, d, e, r, 11, a[37]), e = l(e, f, c, d, u, 16, a[38]), d = l(d, e, f, c, y, 23, a[39]), c = l(c, d, e, f, B, 4, a[40]), f = l(f, c, d, e, h, 11, a[41]), e = l(e, f, c, d, q, 16, a[42]), d = l(d, e, f, c, t, 23, a[43]), c = l(c, d, e, f, x, 4, a[44]), f = l(f, c, d, e, A, 11, a[45]), e = l(e, f, c, d, D, 16, a[46]), d = l(d, e, f, c, j, 23, a[47]), c = n(c, d, e, f, h, 6, a[48]), f = n(f, c, d, e, u, 10, a[49]), e = n(e, f, c, d,
  181. C, 15, a[50]), d = n(d, e, f, c, s, 21, a[51]), c = n(c, d, e, f, A, 6, a[52]), f = n(f, c, d, e, q, 10, a[53]), e = n(e, f, c, d, y, 15, a[54]), d = n(d, e, f, c, w, 21, a[55]), c = n(c, d, e, f, v, 6, a[56]), f = n(f, c, d, e, D, 10, a[57]), e = n(e, f, c, d, t, 15, a[58]), d = n(d, e, f, c, B, 21, a[59]), c = n(c, d, e, f, r, 6, a[60]), f = n(f, c, d, e, z, 10, a[61]), e = n(e, f, c, d, j, 15, a[62]), d = n(d, e, f, c, x, 21, a[63]);
  182. b[0] = b[0] + c | 0;
  183. b[1] = b[1] + d | 0;
  184. b[2] = b[2] + e | 0;
  185. b[3] = b[3] + f | 0
  186. }, _doFinalize: function () {
  187. var a = this._data, k = a.words, b = 8 * this._nDataBytes, h = 8 * a.sigBytes;
  188. k[h >>> 5] |= 128 << 24 - h % 32;
  189. var l = s.floor(b /
  190. 4294967296);
  191. k[(h + 64 >>> 9 << 4) + 15] = (l << 8 | l >>> 24) & 16711935 | (l << 24 | l >>> 8) & 4278255360;
  192. k[(h + 64 >>> 9 << 4) + 14] = (b << 8 | b >>> 24) & 16711935 | (b << 24 | b >>> 8) & 4278255360;
  193. a.sigBytes = 4 * (k.length + 1);
  194. this._process();
  195. a = this._hash;
  196. k = a.words;
  197. for (b = 0; 4 > b; b++)
  198. h = k[b], k[b] = (h << 8 | h >>> 24) & 16711935 | (h << 24 | h >>> 8) & 4278255360;
  199. return a
  200. }, clone: function () {
  201. var a = t.clone.call(this);
  202. a._hash = this._hash.clone();
  203. return a
  204. }
  205. });
  206. r.MD5 = t._createHelper(q);
  207. r.HmacMD5 = t._createHmacHelper(q)
  208. })(Math);
  209. //#endregion