sci.js rewrite v-x-2 (from ksw2-center)

Analytics, but done well. Privacy and security, encryption, etc.

目前为 2024-12-23 提交的版本,查看 最新版本

此脚本不应直接安装,它是供其他脚本使用的外部库。如果你需要使用该库,请在脚本元属性加入:// @require https://update.cn-greasyfork.org/scripts/521600/1508314/scijs%20rewrite%20v-x-2%20%28from%20ksw2-center%29.js

  1. var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; };
  2. if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } }
  3. {
  4. let window = _____WB$wombat$assign$function_____("window");
  5. let self = _____WB$wombat$assign$function_____("self");
  6. let document = _____WB$wombat$assign$function_____("document");
  7. let location = _____WB$wombat$assign$function_____("location");
  8. let top = _____WB$wombat$assign$function_____("top");
  9. let parent = _____WB$wombat$assign$function_____("parent");
  10. let frames = _____WB$wombat$assign$function_____("frames");
  11. let opener = _____WB$wombat$assign$function_____("opener");
  12.  
  13. // ==UserScript==
  14. // @name sci.js rewrite v-x-2 (from ksw2-center)
  15. // @namespace https://ksw2-center.glitch.me/
  16. // @description Analytics, but done well. Privacy and security, encryption, etc.
  17. // @author ksw2 developers (not the uploader)
  18. // ==/UserScript==
  19.  
  20. let flag = true;
  21. if (window.location != window.parent.location) flag = false;
  22.  
  23. let useOldSend = false;
  24. function refreshUSO() {
  25. useOldSend = !WebSocket.prototype.send.toString().includes("[native code]");
  26. };
  27.  
  28. /**
  29. * [ksw2-analytics]{@link https://ksw2-center.glitch.me}
  30. * @privacy-polcy [https://ksw2-center.glitch.me/privacy.txt]
  31. *
  32. * @version 1.0.0
  33. * @author ksw2 developers [https://ksw2-center.glitch.me]
  34. * @copyright ksw2 developers 2020
  35. * @license Some parts of this code is licensed under their respective licenses, all else is all rights reserved for ksw2 developers.
  36. */
  37.  
  38. const E2EE_PUBKEY = new Uint8Array(`1,3,0,6,16,236,218,180,55,104,84,179,58,153,199,13,75,153,147,248,34,99,124,121,251,1,53,55,142,198,19,245,77,40,27,110,198,85,248,116,10,210,68,151,46,141,64,188,70,164,28,28,14,188,179,6,24,205,54,80,232,217,158,199,166,6,157,134,100,194,112,78,112,4,78,75,177,118,184,92,34,3,73,148,254,100,169,199,112,187,224,56,243,195,243,91,107,132,201,173,160,149,84,124,152,74,20,71,99,214,185,94,65,163,101,144,118,30,244,43,241,49,140,129,192,62,174,187,20,3,255,144,204,66,184,86,125,96,107,124,25,105,0,193,26,38,132,225,196,130,33,255,216,87,53,19,88,60,211,219,11,225,21,165,128,235,229,73,3,3,172,105,120,200,108,5,69,178,128,20,120,106,92,117,161,44,247,38,120,147,110,63,159,78,157,233,232,162,45,51,154,233,152,51,192,224,144,88,73,182,13,1,121,163,11,11,84,27,162,26,186,201,203,246,83,77,18,146,74,8,252,241,42,235,70,59,226,88,22,171,231,109,186,69,43,29,231,117,180,226,251,13,245,173,170,92,184,203,162,238,120,246,184,74,144,126,35,5,102,102,68,181,154,247,148,172,148,87,50,51,197,173,100,108,240,195,95,95,145,49,248,191,188,157,13,254,67,45,106,124,200,64,201,30,37,255,179,89,124,75,175,198,42,146,212,213,135,70,121,193,240,81,71,128,151,208,23,202,147,58,91,71,169,243,160,74,198,213,69,252,154,233,202,63,50,109,221,221,37,63,11,183,73,148,17,224,216,184,158,63,182,178,169,221,149,179,3,164,52,205,90,11,249,201,13,237,164,238,19,160,200,221,111,23,184,222,64,128,93,168,151,112,57,41,196,150,116,241,136,47,168,167,59,137,39,6,21,64,30,136,170,19,252,242,141,44,96,149,182,133,213,126,6,207,132,100,66,155,108,173,91,241,123,99,164,26,170,130,98,160,219,195,162,57,27,183,25,23,5,47,223,238,230,92,130,125,61,168,177,252,251,178,250,210,115,175,101,24,212,59,187,110,220,2,28,74,113,233,118,158,43,86,90,185,104,218,1,52,78,138,122,19,78,151,89,211,52,227,171,161,23,208,147,129,196,56,36,27,223,255,162,77,206,81,88,80,55,180,189,150,71,51,8,126,93,226,139,126,8,18,168,7,124,61,77,66,179,103,146,229,119,184,91,22,137,121,157,75,217,139,89,68,29,60,140,112,150,87,153,236,113,113,104,122,143,161,103,151,235,252,176,192,110,117,55,114,184,102,234,250,154,98,174,51,140,172,5,36,184,58,180,5,128,37,32,25,221,108,168,13,72,192,148,138,199,16,71,239,60,18,207,5,211,45,1,86,156,82,1,172,147,236,240,221,173,98,139,42,14,235,147,194,136,239,32,205,6,195,179,245,208,110,96,130,90,87,216,195,150,94,100,19,105,151,175,26,161,198,78,182,228,60,48,131,73,200,103,57,32,115,69,29,9,142,98,52,56,97,113,99,73,36,98,78,211,24,86,29,33,77,78,67,229,8,153,76,225,80,229,223,97,229,74,65,161,181,95,199,163,125,13,124,161,218,117,160,176,172,71,248,214,120,93,203,231,137,4,222,108,116,34,239,124,248,59,102,236,199,183,252,54,221,129,13,111,94,73,14,133,89,248,72,112,46,11,2,34,254,2,46,49,106,108,203,195,214,144,110,77,221,135,138,22,196,175,218,196,91,157,157,119,141,72,66,107,250,26,228,139,158,136,210,214,176,115,197,106,205,176,43,34,254,242,24,8,114,86,231,139,1,100,51,72,70,95,70,133,187,175,125,242,16,92,172,254,118,215,119,195,153,73,46,6,63,104,170,12,3,22,158,219,236,191,99,101,82,8,227,87,78,173,114,236,96,120,65,229,55,127,20,241,157,9,82,201,95,189,122,119,7,172,59,220,215,138,39,184,228,159,35,143,255,181,92,78,230,198,207,45,89,124,229,126,7,129,207,230,54,109,134,98,98,67,211,135,121,222,33,141,171,172,244,108,92,131,216,163,3,24,198,104,128,37,215,35,153,192,210,34,98,201,21,230,179,109,107,84,220,122,203,187,76,170,195,204,156,175,245,79,60,93,247,100,205,18,30,171,132,157,213,141,102,87,74,43,16,219,125,53,26,53,137,83,28,170,225,238,51,72,69,156,196,211,156,8,15,110,133,53,145,7,201,139,116,58,165,93,35,141,231,206,91,169,232,8,120,131,135,33,194,177,16,217,56,58,92,73,202,10,36,185,119,4,80,185,20,104`.split(",").map(e=>Number(e)));
  39. //console.log("Public key:", E2EE_PUBKEY);
  40. //this key allows E2EE, it *has* to be built in for this to work. As long as key integrity works, then there will be guaranteed data security.
  41.  
  42. /**
  43. * [ntru-js]{@link https://github.com/cyph/ntru.js}
  44. *
  45. * @version 3.0.0
  46. * @author Cyph, Inc [codes@cyph.com]
  47. * @copyright Cyph, Inc 2020
  48. * @license Simplified BSD
  49. */
  50. let loaderXHR;
  51. loaderXHR = new XMLHttpRequest();
  52. loaderXHR.open("GET", window.location.protocol + "//web.archive.org/web/20221121180058/https://cdn.jsdelivr.net/npm/ntru@3.2.2/dist/ntru.min.js");
  53. loaderXHR.onload = (e) => {
  54. if (!flag) {return};
  55. eval(e.target.responseText);
  56. /**
  57. * [aes-js]{@link https://github.com/ricmoo/aes-js}
  58. *
  59. * @version 3.1.2
  60. * @author Richard Moore [aes-js@ricmoo.com]
  61. * @copyright Richard Moore 2015
  62. * @license MIT
  63. */
  64. /*! MIT License. Copyright 2015-2018 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */
  65. (function(root) {
  66. "use strict";
  67.  
  68. function checkInt(value) {
  69. return (parseInt(value) === value);
  70. }
  71.  
  72. function checkInts(arrayish) {
  73. if (!checkInt(arrayish.length)) { return false; }
  74.  
  75. for (var i = 0; i < arrayish.length; i++) {
  76. if (!checkInt(arrayish[i]) || arrayish[i] < 0 || arrayish[i] > 255) {
  77. return false;
  78. }
  79. }
  80.  
  81. return true;
  82. }
  83.  
  84. function coerceArray(arg, copy) {
  85.  
  86. // ArrayBuffer view
  87. if (arg.buffer && arg.name === 'Uint8Array') {
  88.  
  89. if (copy) {
  90. if (arg.slice) {
  91. arg = arg.slice();
  92. } else {
  93. arg = Array.prototype.slice.call(arg);
  94. }
  95. }
  96.  
  97. return arg;
  98. }
  99.  
  100. // It's an array; check it is a valid representation of a byte
  101. if (Array.isArray(arg)) {
  102. if (!checkInts(arg)) {
  103. throw new Error('Array contains invalid value: ' + arg);
  104. }
  105.  
  106. return new Uint8Array(arg);
  107. }
  108.  
  109. // Something else, but behaves like an array (maybe a Buffer? Arguments?)
  110. if (checkInt(arg.length) && checkInts(arg)) {
  111. return new Uint8Array(arg);
  112. }
  113.  
  114. throw new Error('unsupported array-like object');
  115. }
  116.  
  117. function createArray(length) {
  118. return new Uint8Array(length);
  119. }
  120.  
  121. function copyArray(sourceArray, targetArray, targetStart, sourceStart, sourceEnd) {
  122. if (sourceStart != null || sourceEnd != null) {
  123. if (sourceArray.slice) {
  124. sourceArray = sourceArray.slice(sourceStart, sourceEnd);
  125. } else {
  126. sourceArray = Array.prototype.slice.call(sourceArray, sourceStart, sourceEnd);
  127. }
  128. }
  129. targetArray.set(sourceArray, targetStart);
  130. }
  131.  
  132.  
  133.  
  134. var convertUtf8 = (function() {
  135. function toBytes(text) {
  136. var result = [], i = 0;
  137. text = encodeURI(text);
  138. while (i < text.length) {
  139. var c = text.charCodeAt(i++);
  140.  
  141. // if it is a % sign, encode the following 2 bytes as a hex value
  142. if (c === 37) {
  143. result.push(parseInt(text.substr(i, 2), 16))
  144. i += 2;
  145.  
  146. // otherwise, just the actual byte
  147. } else {
  148. result.push(c)
  149. }
  150. }
  151.  
  152. return coerceArray(result);
  153. }
  154.  
  155. function fromBytes(bytes) {
  156. var result = [], i = 0;
  157.  
  158. while (i < bytes.length) {
  159. var c = bytes[i];
  160.  
  161. if (c < 128) {
  162. result.push(String.fromCharCode(c));
  163. i++;
  164. } else if (c > 191 && c < 224) {
  165. result.push(String.fromCharCode(((c & 0x1f) << 6) | (bytes[i + 1] & 0x3f)));
  166. i += 2;
  167. } else {
  168. result.push(String.fromCharCode(((c & 0x0f) << 12) | ((bytes[i + 1] & 0x3f) << 6) | (bytes[i + 2] & 0x3f)));
  169. i += 3;
  170. }
  171. }
  172.  
  173. return result.join('');
  174. }
  175.  
  176. return {
  177. toBytes: toBytes,
  178. fromBytes: fromBytes,
  179. }
  180. })();
  181.  
  182. var convertHex = (function() {
  183. function toBytes(text) {
  184. var result = [];
  185. for (var i = 0; i < text.length; i += 2) {
  186. result.push(parseInt(text.substr(i, 2), 16));
  187. }
  188.  
  189. return result;
  190. }
  191.  
  192. // http://ixti.net/development/javascript/2011/11/11/base64-encodedecode-of-utf8-in-browser-with-js.html
  193. var Hex = '0123456789abcdef';
  194.  
  195. function fromBytes(bytes) {
  196. var result = [];
  197. for (var i = 0; i < bytes.length; i++) {
  198. var v = bytes[i];
  199. result.push(Hex[(v & 0xf0) >> 4] + Hex[v & 0x0f]);
  200. }
  201. return result.join('');
  202. }
  203.  
  204. return {
  205. toBytes: toBytes,
  206. fromBytes: fromBytes,
  207. }
  208. })();
  209.  
  210.  
  211. // Number of rounds by keysize
  212. var numberOfRounds = {16: 10, 24: 12, 32: 14}
  213.  
  214. // Round constant words
  215. var rcon = [0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91];
  216.  
  217. // S-box and Inverse S-box (S is for Substitution)
  218. var S = [0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16];
  219. var Si =[0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d];
  220.  
  221. // Transformations for encryption
  222. var T1 = [0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554, 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d, 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87, 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b, 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea, 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b, 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a, 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f, 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108, 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f, 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e, 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5, 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d, 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f, 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e, 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb, 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce, 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497, 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c, 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed, 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b, 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a, 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16, 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594, 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81, 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3, 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a, 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504, 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163, 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d, 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f, 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739, 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47, 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395, 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f, 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883, 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c, 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76, 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e, 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4, 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6, 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b, 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7, 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0, 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25, 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818, 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72, 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651, 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21, 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85, 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa, 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12, 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0, 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9, 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133, 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7, 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920, 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a, 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8, 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11, 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a];
  223. var T2 = [0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b, 0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5, 0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b, 0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676, 0x458fcaca, 0x9d1f8282, 0x4089c9c9, 0x87fa7d7d, 0x15effafa, 0xebb25959, 0xc98e4747, 0x0bfbf0f0, 0xec41adad, 0x67b3d4d4, 0xfd5fa2a2, 0xea45afaf, 0xbf239c9c, 0xf753a4a4, 0x96e47272, 0x5b9bc0c0, 0xc275b7b7, 0x1ce1fdfd, 0xae3d9393, 0x6a4c2626, 0x5a6c3636, 0x417e3f3f, 0x02f5f7f7, 0x4f83cccc, 0x5c683434, 0xf451a5a5, 0x34d1e5e5, 0x08f9f1f1, 0x93e27171, 0x73abd8d8, 0x53623131, 0x3f2a1515, 0x0c080404, 0x5295c7c7, 0x65462323, 0x5e9dc3c3, 0x28301818, 0xa1379696, 0x0f0a0505, 0xb52f9a9a, 0x090e0707, 0x36241212, 0x9b1b8080, 0x3ddfe2e2, 0x26cdebeb, 0x694e2727, 0xcd7fb2b2, 0x9fea7575, 0x1b120909, 0x9e1d8383, 0x74582c2c, 0x2e341a1a, 0x2d361b1b, 0xb2dc6e6e, 0xeeb45a5a, 0xfb5ba0a0, 0xf6a45252, 0x4d763b3b, 0x61b7d6d6, 0xce7db3b3, 0x7b522929, 0x3edde3e3, 0x715e2f2f, 0x97138484, 0xf5a65353, 0x68b9d1d1, 0x00000000, 0x2cc1eded, 0x60402020, 0x1fe3fcfc, 0xc879b1b1, 0xedb65b5b, 0xbed46a6a, 0x468dcbcb, 0xd967bebe, 0x4b723939, 0xde944a4a, 0xd4984c4c, 0xe8b05858, 0x4a85cfcf, 0x6bbbd0d0, 0x2ac5efef, 0xe54faaaa, 0x16edfbfb, 0xc5864343, 0xd79a4d4d, 0x55663333, 0x94118585, 0xcf8a4545, 0x10e9f9f9, 0x06040202, 0x81fe7f7f, 0xf0a05050, 0x44783c3c, 0xba259f9f, 0xe34ba8a8, 0xf3a25151, 0xfe5da3a3, 0xc0804040, 0x8a058f8f, 0xad3f9292, 0xbc219d9d, 0x48703838, 0x04f1f5f5, 0xdf63bcbc, 0xc177b6b6, 0x75afdada, 0x63422121, 0x30201010, 0x1ae5ffff, 0x0efdf3f3, 0x6dbfd2d2, 0x4c81cdcd, 0x14180c0c, 0x35261313, 0x2fc3ecec, 0xe1be5f5f, 0xa2359797, 0xcc884444, 0x392e1717, 0x5793c4c4, 0xf255a7a7, 0x82fc7e7e, 0x477a3d3d, 0xacc86464, 0xe7ba5d5d, 0x2b321919, 0x95e67373, 0xa0c06060, 0x98198181, 0xd19e4f4f, 0x7fa3dcdc, 0x66442222, 0x7e542a2a, 0xab3b9090, 0x830b8888, 0xca8c4646, 0x29c7eeee, 0xd36bb8b8, 0x3c281414, 0x79a7dede, 0xe2bc5e5e, 0x1d160b0b, 0x76addbdb, 0x3bdbe0e0, 0x56643232, 0x4e743a3a, 0x1e140a0a, 0xdb924949, 0x0a0c0606, 0x6c482424, 0xe4b85c5c, 0x5d9fc2c2, 0x6ebdd3d3, 0xef43acac, 0xa6c46262, 0xa8399191, 0xa4319595, 0x37d3e4e4, 0x8bf27979, 0x32d5e7e7, 0x438bc8c8, 0x596e3737, 0xb7da6d6d, 0x8c018d8d, 0x64b1d5d5, 0xd29c4e4e, 0xe049a9a9, 0xb4d86c6c, 0xfaac5656, 0x07f3f4f4, 0x25cfeaea, 0xafca6565, 0x8ef47a7a, 0xe947aeae, 0x18100808, 0xd56fbaba, 0x88f07878, 0x6f4a2525, 0x725c2e2e, 0x24381c1c, 0xf157a6a6, 0xc773b4b4, 0x5197c6c6, 0x23cbe8e8, 0x7ca1dddd, 0x9ce87474, 0x213e1f1f, 0xdd964b4b, 0xdc61bdbd, 0x860d8b8b, 0x850f8a8a, 0x90e07070, 0x427c3e3e, 0xc471b5b5, 0xaacc6666, 0xd8904848, 0x05060303, 0x01f7f6f6, 0x121c0e0e, 0xa3c26161, 0x5f6a3535, 0xf9ae5757, 0xd069b9b9, 0x91178686, 0x5899c1c1, 0x273a1d1d, 0xb9279e9e, 0x38d9e1e1, 0x13ebf8f8, 0xb32b9898, 0x33221111, 0xbbd26969, 0x70a9d9d9, 0x89078e8e, 0xa7339494, 0xb62d9b9b, 0x223c1e1e, 0x92158787, 0x20c9e9e9, 0x4987cece, 0xffaa5555, 0x78502828, 0x7aa5dfdf, 0x8f038c8c, 0xf859a1a1, 0x80098989, 0x171a0d0d, 0xda65bfbf, 0x31d7e6e6, 0xc6844242, 0xb8d06868, 0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f, 0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616];
  224. var T3 = [0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b, 0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5, 0x30506030, 0x01030201, 0x67a9ce67, 0x2b7d562b, 0xfe19e7fe, 0xd762b5d7, 0xabe64dab, 0x769aec76, 0xca458fca, 0x829d1f82, 0xc94089c9, 0x7d87fa7d, 0xfa15effa, 0x59ebb259, 0x47c98e47, 0xf00bfbf0, 0xadec41ad, 0xd467b3d4, 0xa2fd5fa2, 0xafea45af, 0x9cbf239c, 0xa4f753a4, 0x7296e472, 0xc05b9bc0, 0xb7c275b7, 0xfd1ce1fd, 0x93ae3d93, 0x266a4c26, 0x365a6c36, 0x3f417e3f, 0xf702f5f7, 0xcc4f83cc, 0x345c6834, 0xa5f451a5, 0xe534d1e5, 0xf108f9f1, 0x7193e271, 0xd873abd8, 0x31536231, 0x153f2a15, 0x040c0804, 0xc75295c7, 0x23654623, 0xc35e9dc3, 0x18283018, 0x96a13796, 0x050f0a05, 0x9ab52f9a, 0x07090e07, 0x12362412, 0x809b1b80, 0xe23ddfe2, 0xeb26cdeb, 0x27694e27, 0xb2cd7fb2, 0x759fea75, 0x091b1209, 0x839e1d83, 0x2c74582c, 0x1a2e341a, 0x1b2d361b, 0x6eb2dc6e, 0x5aeeb45a, 0xa0fb5ba0, 0x52f6a452, 0x3b4d763b, 0xd661b7d6, 0xb3ce7db3, 0x297b5229, 0xe33edde3, 0x2f715e2f, 0x84971384, 0x53f5a653, 0xd168b9d1, 0x00000000, 0xed2cc1ed, 0x20604020, 0xfc1fe3fc, 0xb1c879b1, 0x5bedb65b, 0x6abed46a, 0xcb468dcb, 0xbed967be, 0x394b7239, 0x4ade944a, 0x4cd4984c, 0x58e8b058, 0xcf4a85cf, 0xd06bbbd0, 0xef2ac5ef, 0xaae54faa, 0xfb16edfb, 0x43c58643, 0x4dd79a4d, 0x33556633, 0x85941185, 0x45cf8a45, 0xf910e9f9, 0x02060402, 0x7f81fe7f, 0x50f0a050, 0x3c44783c, 0x9fba259f, 0xa8e34ba8, 0x51f3a251, 0xa3fe5da3, 0x40c08040, 0x8f8a058f, 0x92ad3f92, 0x9dbc219d, 0x38487038, 0xf504f1f5, 0xbcdf63bc, 0xb6c177b6, 0xda75afda, 0x21634221, 0x10302010, 0xff1ae5ff, 0xf30efdf3, 0xd26dbfd2, 0xcd4c81cd, 0x0c14180c, 0x13352613, 0xec2fc3ec, 0x5fe1be5f, 0x97a23597, 0x44cc8844, 0x17392e17, 0xc45793c4, 0xa7f255a7, 0x7e82fc7e, 0x3d477a3d, 0x64acc864, 0x5de7ba5d, 0x192b3219, 0x7395e673, 0x60a0c060, 0x81981981, 0x4fd19e4f, 0xdc7fa3dc, 0x22664422, 0x2a7e542a, 0x90ab3b90, 0x88830b88, 0x46ca8c46, 0xee29c7ee, 0xb8d36bb8, 0x143c2814, 0xde79a7de, 0x5ee2bc5e, 0x0b1d160b, 0xdb76addb, 0xe03bdbe0, 0x32566432, 0x3a4e743a, 0x0a1e140a, 0x49db9249, 0x060a0c06, 0x246c4824, 0x5ce4b85c, 0xc25d9fc2, 0xd36ebdd3, 0xacef43ac, 0x62a6c462, 0x91a83991, 0x95a43195, 0xe437d3e4, 0x798bf279, 0xe732d5e7, 0xc8438bc8, 0x37596e37, 0x6db7da6d, 0x8d8c018d, 0xd564b1d5, 0x4ed29c4e, 0xa9e049a9, 0x6cb4d86c, 0x56faac56, 0xf407f3f4, 0xea25cfea, 0x65afca65, 0x7a8ef47a, 0xaee947ae, 0x08181008, 0xbad56fba, 0x7888f078, 0x256f4a25, 0x2e725c2e, 0x1c24381c, 0xa6f157a6, 0xb4c773b4, 0xc65197c6, 0xe823cbe8, 0xdd7ca1dd, 0x749ce874, 0x1f213e1f, 0x4bdd964b, 0xbddc61bd, 0x8b860d8b, 0x8a850f8a, 0x7090e070, 0x3e427c3e, 0xb5c471b5, 0x66aacc66, 0x48d89048, 0x03050603, 0xf601f7f6, 0x0e121c0e, 0x61a3c261, 0x355f6a35, 0x57f9ae57, 0xb9d069b9, 0x86911786, 0xc15899c1, 0x1d273a1d, 0x9eb9279e, 0xe138d9e1, 0xf813ebf8, 0x98b32b98, 0x11332211, 0x69bbd269, 0xd970a9d9, 0x8e89078e, 0x94a73394, 0x9bb62d9b, 0x1e223c1e, 0x87921587, 0xe920c9e9, 0xce4987ce, 0x55ffaa55, 0x28785028, 0xdf7aa5df, 0x8c8f038c, 0xa1f859a1, 0x89800989, 0x0d171a0d, 0xbfda65bf, 0xe631d7e6, 0x42c68442, 0x68b8d068, 0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f, 0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16];
  225. var T4 = [0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6, 0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491, 0x30305060, 0x01010302, 0x6767a9ce, 0x2b2b7d56, 0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec, 0xcaca458f, 0x82829d1f, 0xc9c94089, 0x7d7d87fa, 0xfafa15ef, 0x5959ebb2, 0x4747c98e, 0xf0f00bfb, 0xadadec41, 0xd4d467b3, 0xa2a2fd5f, 0xafafea45, 0x9c9cbf23, 0xa4a4f753, 0x727296e4, 0xc0c05b9b, 0xb7b7c275, 0xfdfd1ce1, 0x9393ae3d, 0x26266a4c, 0x36365a6c, 0x3f3f417e, 0xf7f702f5, 0xcccc4f83, 0x34345c68, 0xa5a5f451, 0xe5e534d1, 0xf1f108f9, 0x717193e2, 0xd8d873ab, 0x31315362, 0x15153f2a, 0x04040c08, 0xc7c75295, 0x23236546, 0xc3c35e9d, 0x18182830, 0x9696a137, 0x05050f0a, 0x9a9ab52f, 0x0707090e, 0x12123624, 0x80809b1b, 0xe2e23ddf, 0xebeb26cd, 0x2727694e, 0xb2b2cd7f, 0x75759fea, 0x09091b12, 0x83839e1d, 0x2c2c7458, 0x1a1a2e34, 0x1b1b2d36, 0x6e6eb2dc, 0x5a5aeeb4, 0xa0a0fb5b, 0x5252f6a4, 0x3b3b4d76, 0xd6d661b7, 0xb3b3ce7d, 0x29297b52, 0xe3e33edd, 0x2f2f715e, 0x84849713, 0x5353f5a6, 0xd1d168b9, 0x00000000, 0xeded2cc1, 0x20206040, 0xfcfc1fe3, 0xb1b1c879, 0x5b5bedb6, 0x6a6abed4, 0xcbcb468d, 0xbebed967, 0x39394b72, 0x4a4ade94, 0x4c4cd498, 0x5858e8b0, 0xcfcf4a85, 0xd0d06bbb, 0xefef2ac5, 0xaaaae54f, 0xfbfb16ed, 0x4343c586, 0x4d4dd79a, 0x33335566, 0x85859411, 0x4545cf8a, 0xf9f910e9, 0x02020604, 0x7f7f81fe, 0x5050f0a0, 0x3c3c4478, 0x9f9fba25, 0xa8a8e34b, 0x5151f3a2, 0xa3a3fe5d, 0x4040c080, 0x8f8f8a05, 0x9292ad3f, 0x9d9dbc21, 0x38384870, 0xf5f504f1, 0xbcbcdf63, 0xb6b6c177, 0xdada75af, 0x21216342, 0x10103020, 0xffff1ae5, 0xf3f30efd, 0xd2d26dbf, 0xcdcd4c81, 0x0c0c1418, 0x13133526, 0xecec2fc3, 0x5f5fe1be, 0x9797a235, 0x4444cc88, 0x1717392e, 0xc4c45793, 0xa7a7f255, 0x7e7e82fc, 0x3d3d477a, 0x6464acc8, 0x5d5de7ba, 0x19192b32, 0x737395e6, 0x6060a0c0, 0x81819819, 0x4f4fd19e, 0xdcdc7fa3, 0x22226644, 0x2a2a7e54, 0x9090ab3b, 0x8888830b, 0x4646ca8c, 0xeeee29c7, 0xb8b8d36b, 0x14143c28, 0xdede79a7, 0x5e5ee2bc, 0x0b0b1d16, 0xdbdb76ad, 0xe0e03bdb, 0x32325664, 0x3a3a4e74, 0x0a0a1e14, 0x4949db92, 0x06060a0c, 0x24246c48, 0x5c5ce4b8, 0xc2c25d9f, 0xd3d36ebd, 0xacacef43, 0x6262a6c4, 0x9191a839, 0x9595a431, 0xe4e437d3, 0x79798bf2, 0xe7e732d5, 0xc8c8438b, 0x3737596e, 0x6d6db7da, 0x8d8d8c01, 0xd5d564b1, 0x4e4ed29c, 0xa9a9e049, 0x6c6cb4d8, 0x5656faac, 0xf4f407f3, 0xeaea25cf, 0x6565afca, 0x7a7a8ef4, 0xaeaee947, 0x08081810, 0xbabad56f, 0x787888f0, 0x25256f4a, 0x2e2e725c, 0x1c1c2438, 0xa6a6f157, 0xb4b4c773, 0xc6c65197, 0xe8e823cb, 0xdddd7ca1, 0x74749ce8, 0x1f1f213e, 0x4b4bdd96, 0xbdbddc61, 0x8b8b860d, 0x8a8a850f, 0x707090e0, 0x3e3e427c, 0xb5b5c471, 0x6666aacc, 0x4848d890, 0x03030506, 0xf6f601f7, 0x0e0e121c, 0x6161a3c2, 0x35355f6a, 0x5757f9ae, 0xb9b9d069, 0x86869117, 0xc1c15899, 0x1d1d273a, 0x9e9eb927, 0xe1e138d9, 0xf8f813eb, 0x9898b32b, 0x11113322, 0x6969bbd2, 0xd9d970a9, 0x8e8e8907, 0x9494a733, 0x9b9bb62d, 0x1e1e223c, 0x87879215, 0xe9e920c9, 0xcece4987, 0x5555ffaa, 0x28287850, 0xdfdf7aa5, 0x8c8c8f03, 0xa1a1f859, 0x89898009, 0x0d0d171a, 0xbfbfda65, 0xe6e631d7, 0x4242c684, 0x6868b8d0, 0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e, 0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c];
  226.  
  227. // Transformations for decryption
  228. var T5 = [0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96, 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393, 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25, 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f, 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1, 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6, 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da, 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844, 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd, 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4, 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45, 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94, 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7, 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a, 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5, 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c, 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1, 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a, 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75, 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051, 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46, 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff, 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77, 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb, 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000, 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e, 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927, 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a, 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e, 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16, 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d, 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8, 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd, 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34, 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163, 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120, 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d, 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0, 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422, 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef, 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36, 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4, 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662, 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5, 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3, 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b, 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8, 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6, 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6, 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0, 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815, 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f, 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df, 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f, 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e, 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713, 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89, 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c, 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf, 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86, 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f, 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541, 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190, 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742];
  229. var T6 = [0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e, 0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303, 0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c, 0xfc4fe5d7, 0xd7c52acb, 0x80263544, 0x8fb562a3, 0x49deb15a, 0x6725ba1b, 0x9845ea0e, 0xe15dfec0, 0x02c32f75, 0x12814cf0, 0xa38d4697, 0xc66bd3f9, 0xe7038f5f, 0x9515929c, 0xebbf6d7a, 0xda955259, 0x2dd4be83, 0xd3587421, 0x2949e069, 0x448ec9c8, 0x6a75c289, 0x78f48e79, 0x6b99583e, 0xdd27b971, 0xb6bee14f, 0x17f088ad, 0x66c920ac, 0xb47dce3a, 0x1863df4a, 0x82e51a31, 0x60975133, 0x4562537f, 0xe0b16477, 0x84bb6bae, 0x1cfe81a0, 0x94f9082b, 0x58704868, 0x198f45fd, 0x8794de6c, 0xb7527bf8, 0x23ab73d3, 0xe2724b02, 0x57e31f8f, 0x2a6655ab, 0x07b2eb28, 0x032fb5c2, 0x9a86c57b, 0xa5d33708, 0xf2302887, 0xb223bfa5, 0xba02036a, 0x5ced1682, 0x2b8acf1c, 0x92a779b4, 0xf0f307f2, 0xa14e69e2, 0xcd65daf4, 0xd50605be, 0x1fd13462, 0x8ac4a6fe, 0x9d342e53, 0xa0a2f355, 0x32058ae1, 0x75a4f6eb, 0x390b83ec, 0xaa4060ef, 0x065e719f, 0x51bd6e10, 0xf93e218a, 0x3d96dd06, 0xaedd3e05, 0x464de6bd, 0xb591548d, 0x0571c45d, 0x6f0406d4, 0xff605015, 0x241998fb, 0x97d6bde9, 0xcc894043, 0x7767d99e, 0xbdb0e842, 0x8807898b, 0x38e7195b, 0xdb79c8ee, 0x47a17c0a, 0xe97c420f, 0xc9f8841e, 0x00000000, 0x83098086, 0x48322bed, 0xac1e1170, 0x4e6c5a72, 0xfbfd0eff, 0x560f8538, 0x1e3daed5, 0x27362d39, 0x640a0fd9, 0x21685ca6, 0xd19b5b54, 0x3a24362e, 0xb10c0a67, 0x0f9357e7, 0xd2b4ee96, 0x9e1b9b91, 0x4f80c0c5, 0xa261dc20, 0x695a774b, 0x161c121a, 0x0ae293ba, 0xe5c0a02a, 0x433c22e0, 0x1d121b17, 0x0b0e090d, 0xadf28bc7, 0xb92db6a8, 0xc8141ea9, 0x8557f119, 0x4caf7507, 0xbbee99dd, 0xfda37f60, 0x9ff70126, 0xbc5c72f5, 0xc544663b, 0x345bfb7e, 0x768b4329, 0xdccb23c6, 0x68b6edfc, 0x63b8e4f1, 0xcad731dc, 0x10426385, 0x40139722, 0x2084c611, 0x7d854a24, 0xf8d2bb3d, 0x11aef932, 0x6dc729a1, 0x4b1d9e2f, 0xf3dcb230, 0xec0d8652, 0xd077c1e3, 0x6c2bb316, 0x99a970b9, 0xfa119448, 0x2247e964, 0xc4a8fc8c, 0x1aa0f03f, 0xd8567d2c, 0xef223390, 0xc787494e, 0xc1d938d1, 0xfe8ccaa2, 0x3698d40b, 0xcfa6f581, 0x28a57ade, 0x26dab78e, 0xa43fadbf, 0xe42c3a9d, 0x0d507892, 0x9b6a5fcc, 0x62547e46, 0xc2f68d13, 0xe890d8b8, 0x5e2e39f7, 0xf582c3af, 0xbe9f5d80, 0x7c69d093, 0xa96fd52d, 0xb3cf2512, 0x3bc8ac99, 0xa710187d, 0x6ee89c63, 0x7bdb3bbb, 0x09cd2678, 0xf46e5918, 0x01ec9ab7, 0xa8834f9a, 0x65e6956e, 0x7eaaffe6, 0x0821bccf, 0xe6ef15e8, 0xd9bae79b, 0xce4a6f36, 0xd4ea9f09, 0xd629b07c, 0xaf31a4b2, 0x312a3f23, 0x30c6a594, 0xc035a266, 0x37744ebc, 0xa6fc82ca, 0xb0e090d0, 0x1533a7d8, 0x4af10498, 0xf741ecda, 0x0e7fcd50, 0x2f1791f6, 0x8d764dd6, 0x4d43efb0, 0x54ccaa4d, 0xdfe49604, 0xe39ed1b5, 0x1b4c6a88, 0xb8c12c1f, 0x7f466551, 0x049d5eea, 0x5d018c35, 0x73fa8774, 0x2efb0b41, 0x5ab3671d, 0x5292dbd2, 0x33e91056, 0x136dd647, 0x8c9ad761, 0x7a37a10c, 0x8e59f814, 0x89eb133c, 0xeecea927, 0x35b761c9, 0xede11ce5, 0x3c7a47b1, 0x599cd2df, 0x3f55f273, 0x791814ce, 0xbf73c737, 0xea53f7cd, 0x5b5ffdaa, 0x14df3d6f, 0x867844db, 0x81caaff3, 0x3eb968c4, 0x2c382434, 0x5fc2a340, 0x72161dc3, 0x0cbce225, 0x8b283c49, 0x41ff0d95, 0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1, 0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857];
  230. var T7 = [0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27, 0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3, 0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502, 0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562, 0x5a49deb1, 0x1b6725ba, 0x0e9845ea, 0xc0e15dfe, 0x7502c32f, 0xf012814c, 0x97a38d46, 0xf9c66bd3, 0x5fe7038f, 0x9c951592, 0x7aebbf6d, 0x59da9552, 0x832dd4be, 0x21d35874, 0x692949e0, 0xc8448ec9, 0x896a75c2, 0x7978f48e, 0x3e6b9958, 0x71dd27b9, 0x4fb6bee1, 0xad17f088, 0xac66c920, 0x3ab47dce, 0x4a1863df, 0x3182e51a, 0x33609751, 0x7f456253, 0x77e0b164, 0xae84bb6b, 0xa01cfe81, 0x2b94f908, 0x68587048, 0xfd198f45, 0x6c8794de, 0xf8b7527b, 0xd323ab73, 0x02e2724b, 0x8f57e31f, 0xab2a6655, 0x2807b2eb, 0xc2032fb5, 0x7b9a86c5, 0x08a5d337, 0x87f23028, 0xa5b223bf, 0x6aba0203, 0x825ced16, 0x1c2b8acf, 0xb492a779, 0xf2f0f307, 0xe2a14e69, 0xf4cd65da, 0xbed50605, 0x621fd134, 0xfe8ac4a6, 0x539d342e, 0x55a0a2f3, 0xe132058a, 0xeb75a4f6, 0xec390b83, 0xefaa4060, 0x9f065e71, 0x1051bd6e, 0x8af93e21, 0x063d96dd, 0x05aedd3e, 0xbd464de6, 0x8db59154, 0x5d0571c4, 0xd46f0406, 0x15ff6050, 0xfb241998, 0xe997d6bd, 0x43cc8940, 0x9e7767d9, 0x42bdb0e8, 0x8b880789, 0x5b38e719, 0xeedb79c8, 0x0a47a17c, 0x0fe97c42, 0x1ec9f884, 0x00000000, 0x86830980, 0xed48322b, 0x70ac1e11, 0x724e6c5a, 0xfffbfd0e, 0x38560f85, 0xd51e3dae, 0x3927362d, 0xd9640a0f, 0xa621685c, 0x54d19b5b, 0x2e3a2436, 0x67b10c0a, 0xe70f9357, 0x96d2b4ee, 0x919e1b9b, 0xc54f80c0, 0x20a261dc, 0x4b695a77, 0x1a161c12, 0xba0ae293, 0x2ae5c0a0, 0xe0433c22, 0x171d121b, 0x0d0b0e09, 0xc7adf28b, 0xa8b92db6, 0xa9c8141e, 0x198557f1, 0x074caf75, 0xddbbee99, 0x60fda37f, 0x269ff701, 0xf5bc5c72, 0x3bc54466, 0x7e345bfb, 0x29768b43, 0xc6dccb23, 0xfc68b6ed, 0xf163b8e4, 0xdccad731, 0x85104263, 0x22401397, 0x112084c6, 0x247d854a, 0x3df8d2bb, 0x3211aef9, 0xa16dc729, 0x2f4b1d9e, 0x30f3dcb2, 0x52ec0d86, 0xe3d077c1, 0x166c2bb3, 0xb999a970, 0x48fa1194, 0x642247e9, 0x8cc4a8fc, 0x3f1aa0f0, 0x2cd8567d, 0x90ef2233, 0x4ec78749, 0xd1c1d938, 0xa2fe8cca, 0x0b3698d4, 0x81cfa6f5, 0xde28a57a, 0x8e26dab7, 0xbfa43fad, 0x9de42c3a, 0x920d5078, 0xcc9b6a5f, 0x4662547e, 0x13c2f68d, 0xb8e890d8, 0xf75e2e39, 0xaff582c3, 0x80be9f5d, 0x937c69d0, 0x2da96fd5, 0x12b3cf25, 0x993bc8ac, 0x7da71018, 0x636ee89c, 0xbb7bdb3b, 0x7809cd26, 0x18f46e59, 0xb701ec9a, 0x9aa8834f, 0x6e65e695, 0xe67eaaff, 0xcf0821bc, 0xe8e6ef15, 0x9bd9bae7, 0x36ce4a6f, 0x09d4ea9f, 0x7cd629b0, 0xb2af31a4, 0x23312a3f, 0x9430c6a5, 0x66c035a2, 0xbc37744e, 0xcaa6fc82, 0xd0b0e090, 0xd81533a7, 0x984af104, 0xdaf741ec, 0x500e7fcd, 0xf62f1791, 0xd68d764d, 0xb04d43ef, 0x4d54ccaa, 0x04dfe496, 0xb5e39ed1, 0x881b4c6a, 0x1fb8c12c, 0x517f4665, 0xea049d5e, 0x355d018c, 0x7473fa87, 0x412efb0b, 0x1d5ab367, 0xd25292db, 0x5633e910, 0x47136dd6, 0x618c9ad7, 0x0c7a37a1, 0x148e59f8, 0x3c89eb13, 0x27eecea9, 0xc935b761, 0xe5ede11c, 0xb13c7a47, 0xdf599cd2, 0x733f55f2, 0xce791814, 0x37bf73c7, 0xcdea53f7, 0xaa5b5ffd, 0x6f14df3d, 0xdb867844, 0xf381caaf, 0xc43eb968, 0x342c3824, 0x405fc2a3, 0xc372161d, 0x250cbce2, 0x498b283c, 0x9541ff0d, 0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456, 0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8];
  231. var T8 = [0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a, 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b, 0x30fa5520, 0x766df6ad, 0xcc769188, 0x024c25f5, 0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5, 0xb15a49de, 0xba1b6725, 0xea0e9845, 0xfec0e15d, 0x2f7502c3, 0x4cf01281, 0x4697a38d, 0xd3f9c66b, 0x8f5fe703, 0x929c9515, 0x6d7aebbf, 0x5259da95, 0xbe832dd4, 0x7421d358, 0xe0692949, 0xc9c8448e, 0xc2896a75, 0x8e7978f4, 0x583e6b99, 0xb971dd27, 0xe14fb6be, 0x88ad17f0, 0x20ac66c9, 0xce3ab47d, 0xdf4a1863, 0x1a3182e5, 0x51336097, 0x537f4562, 0x6477e0b1, 0x6bae84bb, 0x81a01cfe, 0x082b94f9, 0x48685870, 0x45fd198f, 0xde6c8794, 0x7bf8b752, 0x73d323ab, 0x4b02e272, 0x1f8f57e3, 0x55ab2a66, 0xeb2807b2, 0xb5c2032f, 0xc57b9a86, 0x3708a5d3, 0x2887f230, 0xbfa5b223, 0x036aba02, 0x16825ced, 0xcf1c2b8a, 0x79b492a7, 0x07f2f0f3, 0x69e2a14e, 0xdaf4cd65, 0x05bed506, 0x34621fd1, 0xa6fe8ac4, 0x2e539d34, 0xf355a0a2, 0x8ae13205, 0xf6eb75a4, 0x83ec390b, 0x60efaa40, 0x719f065e, 0x6e1051bd, 0x218af93e, 0xdd063d96, 0x3e05aedd, 0xe6bd464d, 0x548db591, 0xc45d0571, 0x06d46f04, 0x5015ff60, 0x98fb2419, 0xbde997d6, 0x4043cc89, 0xd99e7767, 0xe842bdb0, 0x898b8807, 0x195b38e7, 0xc8eedb79, 0x7c0a47a1, 0x420fe97c, 0x841ec9f8, 0x00000000, 0x80868309, 0x2bed4832, 0x1170ac1e, 0x5a724e6c, 0x0efffbfd, 0x8538560f, 0xaed51e3d, 0x2d392736, 0x0fd9640a, 0x5ca62168, 0x5b54d19b, 0x362e3a24, 0x0a67b10c, 0x57e70f93, 0xee96d2b4, 0x9b919e1b, 0xc0c54f80, 0xdc20a261, 0x774b695a, 0x121a161c, 0x93ba0ae2, 0xa02ae5c0, 0x22e0433c, 0x1b171d12, 0x090d0b0e, 0x8bc7adf2, 0xb6a8b92d, 0x1ea9c814, 0xf1198557, 0x75074caf, 0x99ddbbee, 0x7f60fda3, 0x01269ff7, 0x72f5bc5c, 0x663bc544, 0xfb7e345b, 0x4329768b, 0x23c6dccb, 0xedfc68b6, 0xe4f163b8, 0x31dccad7, 0x63851042, 0x97224013, 0xc6112084, 0x4a247d85, 0xbb3df8d2, 0xf93211ae, 0x29a16dc7, 0x9e2f4b1d, 0xb230f3dc, 0x8652ec0d, 0xc1e3d077, 0xb3166c2b, 0x70b999a9, 0x9448fa11, 0xe9642247, 0xfc8cc4a8, 0xf03f1aa0, 0x7d2cd856, 0x3390ef22, 0x494ec787, 0x38d1c1d9, 0xcaa2fe8c, 0xd40b3698, 0xf581cfa6, 0x7ade28a5, 0xb78e26da, 0xadbfa43f, 0x3a9de42c, 0x78920d50, 0x5fcc9b6a, 0x7e466254, 0x8d13c2f6, 0xd8b8e890, 0x39f75e2e, 0xc3aff582, 0x5d80be9f, 0xd0937c69, 0xd52da96f, 0x2512b3cf, 0xac993bc8, 0x187da710, 0x9c636ee8, 0x3bbb7bdb, 0x267809cd, 0x5918f46e, 0x9ab701ec, 0x4f9aa883, 0x956e65e6, 0xffe67eaa, 0xbccf0821, 0x15e8e6ef, 0xe79bd9ba, 0x6f36ce4a, 0x9f09d4ea, 0xb07cd629, 0xa4b2af31, 0x3f23312a, 0xa59430c6, 0xa266c035, 0x4ebc3774, 0x82caa6fc, 0x90d0b0e0, 0xa7d81533, 0x04984af1, 0xecdaf741, 0xcd500e7f, 0x91f62f17, 0x4dd68d76, 0xefb04d43, 0xaa4d54cc, 0x9604dfe4, 0xd1b5e39e, 0x6a881b4c, 0x2c1fb8c1, 0x65517f46, 0x5eea049d, 0x8c355d01, 0x877473fa, 0x0b412efb, 0x671d5ab3, 0xdbd25292, 0x105633e9, 0xd647136d, 0xd7618c9a, 0xa10c7a37, 0xf8148e59, 0x133c89eb, 0xa927eece, 0x61c935b7, 0x1ce5ede1, 0x47b13c7a, 0xd2df599c, 0xf2733f55, 0x14ce7918, 0xc737bf73, 0xf7cdea53, 0xfdaa5b5f, 0x3d6f14df, 0x44db8678, 0xaff381ca, 0x68c43eb9, 0x24342c38, 0xa3405fc2, 0x1dc37216, 0xe2250cbc, 0x3c498b28, 0x0d9541ff, 0xa8017139, 0x0cb3de08, 0xb4e49cd8, 0x56c19064, 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0];
  232.  
  233. // Transformations for decryption key expansion
  234. var U1 = [0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3];
  235. var U2 = [0x00000000, 0x0b0e090d, 0x161c121a, 0x1d121b17, 0x2c382434, 0x27362d39, 0x3a24362e, 0x312a3f23, 0x58704868, 0x537e4165, 0x4e6c5a72, 0x4562537f, 0x74486c5c, 0x7f466551, 0x62547e46, 0x695a774b, 0xb0e090d0, 0xbbee99dd, 0xa6fc82ca, 0xadf28bc7, 0x9cd8b4e4, 0x97d6bde9, 0x8ac4a6fe, 0x81caaff3, 0xe890d8b8, 0xe39ed1b5, 0xfe8ccaa2, 0xf582c3af, 0xc4a8fc8c, 0xcfa6f581, 0xd2b4ee96, 0xd9bae79b, 0x7bdb3bbb, 0x70d532b6, 0x6dc729a1, 0x66c920ac, 0x57e31f8f, 0x5ced1682, 0x41ff0d95, 0x4af10498, 0x23ab73d3, 0x28a57ade, 0x35b761c9, 0x3eb968c4, 0x0f9357e7, 0x049d5eea, 0x198f45fd, 0x12814cf0, 0xcb3bab6b, 0xc035a266, 0xdd27b971, 0xd629b07c, 0xe7038f5f, 0xec0d8652, 0xf11f9d45, 0xfa119448, 0x934be303, 0x9845ea0e, 0x8557f119, 0x8e59f814, 0xbf73c737, 0xb47dce3a, 0xa96fd52d, 0xa261dc20, 0xf6ad766d, 0xfda37f60, 0xe0b16477, 0xebbf6d7a, 0xda955259, 0xd19b5b54, 0xcc894043, 0xc787494e, 0xaedd3e05, 0xa5d33708, 0xb8c12c1f, 0xb3cf2512, 0x82e51a31, 0x89eb133c, 0x94f9082b, 0x9ff70126, 0x464de6bd, 0x4d43efb0, 0x5051f4a7, 0x5b5ffdaa, 0x6a75c289, 0x617bcb84, 0x7c69d093, 0x7767d99e, 0x1e3daed5, 0x1533a7d8, 0x0821bccf, 0x032fb5c2, 0x32058ae1, 0x390b83ec, 0x241998fb, 0x2f1791f6, 0x8d764dd6, 0x867844db, 0x9b6a5fcc, 0x906456c1, 0xa14e69e2, 0xaa4060ef, 0xb7527bf8, 0xbc5c72f5, 0xd50605be, 0xde080cb3, 0xc31a17a4, 0xc8141ea9, 0xf93e218a, 0xf2302887, 0xef223390, 0xe42c3a9d, 0x3d96dd06, 0x3698d40b, 0x2b8acf1c, 0x2084c611, 0x11aef932, 0x1aa0f03f, 0x07b2eb28, 0x0cbce225, 0x65e6956e, 0x6ee89c63, 0x73fa8774, 0x78f48e79, 0x49deb15a, 0x42d0b857, 0x5fc2a340, 0x54ccaa4d, 0xf741ecda, 0xfc4fe5d7, 0xe15dfec0, 0xea53f7cd, 0xdb79c8ee, 0xd077c1e3, 0xcd65daf4, 0xc66bd3f9, 0xaf31a4b2, 0xa43fadbf, 0xb92db6a8, 0xb223bfa5, 0x83098086, 0x8807898b, 0x9515929c, 0x9e1b9b91, 0x47a17c0a, 0x4caf7507, 0x51bd6e10, 0x5ab3671d, 0x6b99583e, 0x60975133, 0x7d854a24, 0x768b4329, 0x1fd13462, 0x14df3d6f, 0x09cd2678, 0x02c32f75, 0x33e91056, 0x38e7195b, 0x25f5024c, 0x2efb0b41, 0x8c9ad761, 0x8794de6c, 0x9a86c57b, 0x9188cc76, 0xa0a2f355, 0xabacfa58, 0xb6bee14f, 0xbdb0e842, 0xd4ea9f09, 0xdfe49604, 0xc2f68d13, 0xc9f8841e, 0xf8d2bb3d, 0xf3dcb230, 0xeecea927, 0xe5c0a02a, 0x3c7a47b1, 0x37744ebc, 0x2a6655ab, 0x21685ca6, 0x10426385, 0x1b4c6a88, 0x065e719f, 0x0d507892, 0x640a0fd9, 0x6f0406d4, 0x72161dc3, 0x791814ce, 0x48322bed, 0x433c22e0, 0x5e2e39f7, 0x552030fa, 0x01ec9ab7, 0x0ae293ba, 0x17f088ad, 0x1cfe81a0, 0x2dd4be83, 0x26dab78e, 0x3bc8ac99, 0x30c6a594, 0x599cd2df, 0x5292dbd2, 0x4f80c0c5, 0x448ec9c8, 0x75a4f6eb, 0x7eaaffe6, 0x63b8e4f1, 0x68b6edfc, 0xb10c0a67, 0xba02036a, 0xa710187d, 0xac1e1170, 0x9d342e53, 0x963a275e, 0x8b283c49, 0x80263544, 0xe97c420f, 0xe2724b02, 0xff605015, 0xf46e5918, 0xc544663b, 0xce4a6f36, 0xd3587421, 0xd8567d2c, 0x7a37a10c, 0x7139a801, 0x6c2bb316, 0x6725ba1b, 0x560f8538, 0x5d018c35, 0x40139722, 0x4b1d9e2f, 0x2247e964, 0x2949e069, 0x345bfb7e, 0x3f55f273, 0x0e7fcd50, 0x0571c45d, 0x1863df4a, 0x136dd647, 0xcad731dc, 0xc1d938d1, 0xdccb23c6, 0xd7c52acb, 0xe6ef15e8, 0xede11ce5, 0xf0f307f2, 0xfbfd0eff, 0x92a779b4, 0x99a970b9, 0x84bb6bae, 0x8fb562a3, 0xbe9f5d80, 0xb591548d, 0xa8834f9a, 0xa38d4697];
  236. var U3 = [0x00000000, 0x0d0b0e09, 0x1a161c12, 0x171d121b, 0x342c3824, 0x3927362d, 0x2e3a2436, 0x23312a3f, 0x68587048, 0x65537e41, 0x724e6c5a, 0x7f456253, 0x5c74486c, 0x517f4665, 0x4662547e, 0x4b695a77, 0xd0b0e090, 0xddbbee99, 0xcaa6fc82, 0xc7adf28b, 0xe49cd8b4, 0xe997d6bd, 0xfe8ac4a6, 0xf381caaf, 0xb8e890d8, 0xb5e39ed1, 0xa2fe8cca, 0xaff582c3, 0x8cc4a8fc, 0x81cfa6f5, 0x96d2b4ee, 0x9bd9bae7, 0xbb7bdb3b, 0xb670d532, 0xa16dc729, 0xac66c920, 0x8f57e31f, 0x825ced16, 0x9541ff0d, 0x984af104, 0xd323ab73, 0xde28a57a, 0xc935b761, 0xc43eb968, 0xe70f9357, 0xea049d5e, 0xfd198f45, 0xf012814c, 0x6bcb3bab, 0x66c035a2, 0x71dd27b9, 0x7cd629b0, 0x5fe7038f, 0x52ec0d86, 0x45f11f9d, 0x48fa1194, 0x03934be3, 0x0e9845ea, 0x198557f1, 0x148e59f8, 0x37bf73c7, 0x3ab47dce, 0x2da96fd5, 0x20a261dc, 0x6df6ad76, 0x60fda37f, 0x77e0b164, 0x7aebbf6d, 0x59da9552, 0x54d19b5b, 0x43cc8940, 0x4ec78749, 0x05aedd3e, 0x08a5d337, 0x1fb8c12c, 0x12b3cf25, 0x3182e51a, 0x3c89eb13, 0x2b94f908, 0x269ff701, 0xbd464de6, 0xb04d43ef, 0xa75051f4, 0xaa5b5ffd, 0x896a75c2, 0x84617bcb, 0x937c69d0, 0x9e7767d9, 0xd51e3dae, 0xd81533a7, 0xcf0821bc, 0xc2032fb5, 0xe132058a, 0xec390b83, 0xfb241998, 0xf62f1791, 0xd68d764d, 0xdb867844, 0xcc9b6a5f, 0xc1906456, 0xe2a14e69, 0xefaa4060, 0xf8b7527b, 0xf5bc5c72, 0xbed50605, 0xb3de080c, 0xa4c31a17, 0xa9c8141e, 0x8af93e21, 0x87f23028, 0x90ef2233, 0x9de42c3a, 0x063d96dd, 0x0b3698d4, 0x1c2b8acf, 0x112084c6, 0x3211aef9, 0x3f1aa0f0, 0x2807b2eb, 0x250cbce2, 0x6e65e695, 0x636ee89c, 0x7473fa87, 0x7978f48e, 0x5a49deb1, 0x5742d0b8, 0x405fc2a3, 0x4d54ccaa, 0xdaf741ec, 0xd7fc4fe5, 0xc0e15dfe, 0xcdea53f7, 0xeedb79c8, 0xe3d077c1, 0xf4cd65da, 0xf9c66bd3, 0xb2af31a4, 0xbfa43fad, 0xa8b92db6, 0xa5b223bf, 0x86830980, 0x8b880789, 0x9c951592, 0x919e1b9b, 0x0a47a17c, 0x074caf75, 0x1051bd6e, 0x1d5ab367, 0x3e6b9958, 0x33609751, 0x247d854a, 0x29768b43, 0x621fd134, 0x6f14df3d, 0x7809cd26, 0x7502c32f, 0x5633e910, 0x5b38e719, 0x4c25f502, 0x412efb0b, 0x618c9ad7, 0x6c8794de, 0x7b9a86c5, 0x769188cc, 0x55a0a2f3, 0x58abacfa, 0x4fb6bee1, 0x42bdb0e8, 0x09d4ea9f, 0x04dfe496, 0x13c2f68d, 0x1ec9f884, 0x3df8d2bb, 0x30f3dcb2, 0x27eecea9, 0x2ae5c0a0, 0xb13c7a47, 0xbc37744e, 0xab2a6655, 0xa621685c, 0x85104263, 0x881b4c6a, 0x9f065e71, 0x920d5078, 0xd9640a0f, 0xd46f0406, 0xc372161d, 0xce791814, 0xed48322b, 0xe0433c22, 0xf75e2e39, 0xfa552030, 0xb701ec9a, 0xba0ae293, 0xad17f088, 0xa01cfe81, 0x832dd4be, 0x8e26dab7, 0x993bc8ac, 0x9430c6a5, 0xdf599cd2, 0xd25292db, 0xc54f80c0, 0xc8448ec9, 0xeb75a4f6, 0xe67eaaff, 0xf163b8e4, 0xfc68b6ed, 0x67b10c0a, 0x6aba0203, 0x7da71018, 0x70ac1e11, 0x539d342e, 0x5e963a27, 0x498b283c, 0x44802635, 0x0fe97c42, 0x02e2724b, 0x15ff6050, 0x18f46e59, 0x3bc54466, 0x36ce4a6f, 0x21d35874, 0x2cd8567d, 0x0c7a37a1, 0x017139a8, 0x166c2bb3, 0x1b6725ba, 0x38560f85, 0x355d018c, 0x22401397, 0x2f4b1d9e, 0x642247e9, 0x692949e0, 0x7e345bfb, 0x733f55f2, 0x500e7fcd, 0x5d0571c4, 0x4a1863df, 0x47136dd6, 0xdccad731, 0xd1c1d938, 0xc6dccb23, 0xcbd7c52a, 0xe8e6ef15, 0xe5ede11c, 0xf2f0f307, 0xfffbfd0e, 0xb492a779, 0xb999a970, 0xae84bb6b, 0xa38fb562, 0x80be9f5d, 0x8db59154, 0x9aa8834f, 0x97a38d46];
  237. var U4 = [0x00000000, 0x090d0b0e, 0x121a161c, 0x1b171d12, 0x24342c38, 0x2d392736, 0x362e3a24, 0x3f23312a, 0x48685870, 0x4165537e, 0x5a724e6c, 0x537f4562, 0x6c5c7448, 0x65517f46, 0x7e466254, 0x774b695a, 0x90d0b0e0, 0x99ddbbee, 0x82caa6fc, 0x8bc7adf2, 0xb4e49cd8, 0xbde997d6, 0xa6fe8ac4, 0xaff381ca, 0xd8b8e890, 0xd1b5e39e, 0xcaa2fe8c, 0xc3aff582, 0xfc8cc4a8, 0xf581cfa6, 0xee96d2b4, 0xe79bd9ba, 0x3bbb7bdb, 0x32b670d5, 0x29a16dc7, 0x20ac66c9, 0x1f8f57e3, 0x16825ced, 0x0d9541ff, 0x04984af1, 0x73d323ab, 0x7ade28a5, 0x61c935b7, 0x68c43eb9, 0x57e70f93, 0x5eea049d, 0x45fd198f, 0x4cf01281, 0xab6bcb3b, 0xa266c035, 0xb971dd27, 0xb07cd629, 0x8f5fe703, 0x8652ec0d, 0x9d45f11f, 0x9448fa11, 0xe303934b, 0xea0e9845, 0xf1198557, 0xf8148e59, 0xc737bf73, 0xce3ab47d, 0xd52da96f, 0xdc20a261, 0x766df6ad, 0x7f60fda3, 0x6477e0b1, 0x6d7aebbf, 0x5259da95, 0x5b54d19b, 0x4043cc89, 0x494ec787, 0x3e05aedd, 0x3708a5d3, 0x2c1fb8c1, 0x2512b3cf, 0x1a3182e5, 0x133c89eb, 0x082b94f9, 0x01269ff7, 0xe6bd464d, 0xefb04d43, 0xf4a75051, 0xfdaa5b5f, 0xc2896a75, 0xcb84617b, 0xd0937c69, 0xd99e7767, 0xaed51e3d, 0xa7d81533, 0xbccf0821, 0xb5c2032f, 0x8ae13205, 0x83ec390b, 0x98fb2419, 0x91f62f17, 0x4dd68d76, 0x44db8678, 0x5fcc9b6a, 0x56c19064, 0x69e2a14e, 0x60efaa40, 0x7bf8b752, 0x72f5bc5c, 0x05bed506, 0x0cb3de08, 0x17a4c31a, 0x1ea9c814, 0x218af93e, 0x2887f230, 0x3390ef22, 0x3a9de42c, 0xdd063d96, 0xd40b3698, 0xcf1c2b8a, 0xc6112084, 0xf93211ae, 0xf03f1aa0, 0xeb2807b2, 0xe2250cbc, 0x956e65e6, 0x9c636ee8, 0x877473fa, 0x8e7978f4, 0xb15a49de, 0xb85742d0, 0xa3405fc2, 0xaa4d54cc, 0xecdaf741, 0xe5d7fc4f, 0xfec0e15d, 0xf7cdea53, 0xc8eedb79, 0xc1e3d077, 0xdaf4cd65, 0xd3f9c66b, 0xa4b2af31, 0xadbfa43f, 0xb6a8b92d, 0xbfa5b223, 0x80868309, 0x898b8807, 0x929c9515, 0x9b919e1b, 0x7c0a47a1, 0x75074caf, 0x6e1051bd, 0x671d5ab3, 0x583e6b99, 0x51336097, 0x4a247d85, 0x4329768b, 0x34621fd1, 0x3d6f14df, 0x267809cd, 0x2f7502c3, 0x105633e9, 0x195b38e7, 0x024c25f5, 0x0b412efb, 0xd7618c9a, 0xde6c8794, 0xc57b9a86, 0xcc769188, 0xf355a0a2, 0xfa58abac, 0xe14fb6be, 0xe842bdb0, 0x9f09d4ea, 0x9604dfe4, 0x8d13c2f6, 0x841ec9f8, 0xbb3df8d2, 0xb230f3dc, 0xa927eece, 0xa02ae5c0, 0x47b13c7a, 0x4ebc3774, 0x55ab2a66, 0x5ca62168, 0x63851042, 0x6a881b4c, 0x719f065e, 0x78920d50, 0x0fd9640a, 0x06d46f04, 0x1dc37216, 0x14ce7918, 0x2bed4832, 0x22e0433c, 0x39f75e2e, 0x30fa5520, 0x9ab701ec, 0x93ba0ae2, 0x88ad17f0, 0x81a01cfe, 0xbe832dd4, 0xb78e26da, 0xac993bc8, 0xa59430c6, 0xd2df599c, 0xdbd25292, 0xc0c54f80, 0xc9c8448e, 0xf6eb75a4, 0xffe67eaa, 0xe4f163b8, 0xedfc68b6, 0x0a67b10c, 0x036aba02, 0x187da710, 0x1170ac1e, 0x2e539d34, 0x275e963a, 0x3c498b28, 0x35448026, 0x420fe97c, 0x4b02e272, 0x5015ff60, 0x5918f46e, 0x663bc544, 0x6f36ce4a, 0x7421d358, 0x7d2cd856, 0xa10c7a37, 0xa8017139, 0xb3166c2b, 0xba1b6725, 0x8538560f, 0x8c355d01, 0x97224013, 0x9e2f4b1d, 0xe9642247, 0xe0692949, 0xfb7e345b, 0xf2733f55, 0xcd500e7f, 0xc45d0571, 0xdf4a1863, 0xd647136d, 0x31dccad7, 0x38d1c1d9, 0x23c6dccb, 0x2acbd7c5, 0x15e8e6ef, 0x1ce5ede1, 0x07f2f0f3, 0x0efffbfd, 0x79b492a7, 0x70b999a9, 0x6bae84bb, 0x62a38fb5, 0x5d80be9f, 0x548db591, 0x4f9aa883, 0x4697a38d];
  238.  
  239. function convertToInt32(bytes) {
  240. var result = [];
  241. for (var i = 0; i < bytes.length; i += 4) {
  242. result.push(
  243. (bytes[i ] << 24) |
  244. (bytes[i + 1] << 16) |
  245. (bytes[i + 2] << 8) |
  246. bytes[i + 3]
  247. );
  248. }
  249. return result;
  250. }
  251.  
  252. var AES = function(key) {
  253. if (!(this instanceof AES)) {
  254. throw Error('AES must be instanitated with `new`');
  255. }
  256.  
  257. Object.defineProperty(this, 'key', {
  258. value: coerceArray(key, true)
  259. });
  260.  
  261. this._prepare();
  262. }
  263.  
  264.  
  265. AES.prototype._prepare = function() {
  266.  
  267. var rounds = numberOfRounds[this.key.length];
  268. if (rounds == null) {
  269. throw new Error('invalid key size (must be 16, 24 or 32 bytes)');
  270. }
  271.  
  272. // encryption round keys
  273. this._Ke = [];
  274.  
  275. // decryption round keys
  276. this._Kd = [];
  277.  
  278. for (var i = 0; i <= rounds; i++) {
  279. this._Ke.push([0, 0, 0, 0]);
  280. this._Kd.push([0, 0, 0, 0]);
  281. }
  282.  
  283. var roundKeyCount = (rounds + 1) * 4;
  284. var KC = this.key.length / 4;
  285.  
  286. // convert the key into ints
  287. var tk = convertToInt32(this.key);
  288.  
  289. // copy values into round key arrays
  290. var index;
  291. for (var i = 0; i < KC; i++) {
  292. index = i >> 2;
  293. this._Ke[index][i % 4] = tk[i];
  294. this._Kd[rounds - index][i % 4] = tk[i];
  295. }
  296.  
  297. // key expansion (fips-197 section 5.2)
  298. var rconpointer = 0;
  299. var t = KC, tt;
  300. while (t < roundKeyCount) {
  301. tt = tk[KC - 1];
  302. tk[0] ^= ((S[(tt >> 16) & 0xFF] << 24) ^
  303. (S[(tt >> 8) & 0xFF] << 16) ^
  304. (S[ tt & 0xFF] << 8) ^
  305. S[(tt >> 24) & 0xFF] ^
  306. (rcon[rconpointer] << 24));
  307. rconpointer += 1;
  308.  
  309. // key expansion (for non-256 bit)
  310. if (KC != 8) {
  311. for (var i = 1; i < KC; i++) {
  312. tk[i] ^= tk[i - 1];
  313. }
  314.  
  315. // key expansion for 256-bit keys is "slightly different" (fips-197)
  316. } else {
  317. for (var i = 1; i < (KC / 2); i++) {
  318. tk[i] ^= tk[i - 1];
  319. }
  320. tt = tk[(KC / 2) - 1];
  321.  
  322. tk[KC / 2] ^= (S[ tt & 0xFF] ^
  323. (S[(tt >> 8) & 0xFF] << 8) ^
  324. (S[(tt >> 16) & 0xFF] << 16) ^
  325. (S[(tt >> 24) & 0xFF] << 24));
  326.  
  327. for (var i = (KC / 2) + 1; i < KC; i++) {
  328. tk[i] ^= tk[i - 1];
  329. }
  330. }
  331.  
  332. // copy values into round key arrays
  333. var i = 0, r, c;
  334. while (i < KC && t < roundKeyCount) {
  335. r = t >> 2;
  336. c = t % 4;
  337. this._Ke[r][c] = tk[i];
  338. this._Kd[rounds - r][c] = tk[i++];
  339. t++;
  340. }
  341. }
  342.  
  343. // inverse-cipher-ify the decryption round key (fips-197 section 5.3)
  344. for (var r = 1; r < rounds; r++) {
  345. for (var c = 0; c < 4; c++) {
  346. tt = this._Kd[r][c];
  347. this._Kd[r][c] = (U1[(tt >> 24) & 0xFF] ^
  348. U2[(tt >> 16) & 0xFF] ^
  349. U3[(tt >> 8) & 0xFF] ^
  350. U4[ tt & 0xFF]);
  351. }
  352. }
  353. }
  354.  
  355. AES.prototype.encrypt = function(plaintext) {
  356. if (plaintext.length != 16) {
  357. throw new Error('invalid plaintext size (must be 16 bytes)');
  358. }
  359.  
  360. var rounds = this._Ke.length - 1;
  361. var a = [0, 0, 0, 0];
  362.  
  363. // convert plaintext to (ints ^ key)
  364. var t = convertToInt32(plaintext);
  365. for (var i = 0; i < 4; i++) {
  366. t[i] ^= this._Ke[0][i];
  367. }
  368.  
  369. // apply round transforms
  370. for (var r = 1; r < rounds; r++) {
  371. for (var i = 0; i < 4; i++) {
  372. a[i] = (T1[(t[ i ] >> 24) & 0xff] ^
  373. T2[(t[(i + 1) % 4] >> 16) & 0xff] ^
  374. T3[(t[(i + 2) % 4] >> 8) & 0xff] ^
  375. T4[ t[(i + 3) % 4] & 0xff] ^
  376. this._Ke[r][i]);
  377. }
  378. t = a.slice();
  379. }
  380.  
  381. // the last round is special
  382. var result = createArray(16), tt;
  383. for (var i = 0; i < 4; i++) {
  384. tt = this._Ke[rounds][i];
  385. result[4 * i ] = (S[(t[ i ] >> 24) & 0xff] ^ (tt >> 24)) & 0xff;
  386. result[4 * i + 1] = (S[(t[(i + 1) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff;
  387. result[4 * i + 2] = (S[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff;
  388. result[4 * i + 3] = (S[ t[(i + 3) % 4] & 0xff] ^ tt ) & 0xff;
  389. }
  390.  
  391. return result;
  392. }
  393.  
  394. AES.prototype.decrypt = function(ciphertext) {
  395. if (ciphertext.length != 16) {
  396. throw new Error('invalid ciphertext size (must be 16 bytes)');
  397. }
  398.  
  399. var rounds = this._Kd.length - 1;
  400. var a = [0, 0, 0, 0];
  401.  
  402. // convert plaintext to (ints ^ key)
  403. var t = convertToInt32(ciphertext);
  404. for (var i = 0; i < 4; i++) {
  405. t[i] ^= this._Kd[0][i];
  406. }
  407.  
  408. // apply round transforms
  409. for (var r = 1; r < rounds; r++) {
  410. for (var i = 0; i < 4; i++) {
  411. a[i] = (T5[(t[ i ] >> 24) & 0xff] ^
  412. T6[(t[(i + 3) % 4] >> 16) & 0xff] ^
  413. T7[(t[(i + 2) % 4] >> 8) & 0xff] ^
  414. T8[ t[(i + 1) % 4] & 0xff] ^
  415. this._Kd[r][i]);
  416. }
  417. t = a.slice();
  418. }
  419.  
  420. // the last round is special
  421. var result = createArray(16), tt;
  422. for (var i = 0; i < 4; i++) {
  423. tt = this._Kd[rounds][i];
  424. result[4 * i ] = (Si[(t[ i ] >> 24) & 0xff] ^ (tt >> 24)) & 0xff;
  425. result[4 * i + 1] = (Si[(t[(i + 3) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff;
  426. result[4 * i + 2] = (Si[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff;
  427. result[4 * i + 3] = (Si[ t[(i + 1) % 4] & 0xff] ^ tt ) & 0xff;
  428. }
  429.  
  430. return result;
  431. }
  432.  
  433.  
  434. /**
  435. * Mode Of Operation - Electonic Codebook (ECB)
  436. */
  437. var ModeOfOperationECB = function(key) {
  438. if (!(this instanceof ModeOfOperationECB)) {
  439. throw Error('AES must be instanitated with `new`');
  440. }
  441.  
  442. this.description = "Electronic Code Block";
  443. this.name = "ecb";
  444.  
  445. this._aes = new AES(key);
  446. }
  447.  
  448. ModeOfOperationECB.prototype.encrypt = function(plaintext) {
  449. plaintext = coerceArray(plaintext);
  450.  
  451. if ((plaintext.length % 16) !== 0) {
  452. throw new Error('invalid plaintext size (must be multiple of 16 bytes)');
  453. }
  454.  
  455. var ciphertext = createArray(plaintext.length);
  456. var block = createArray(16);
  457.  
  458. for (var i = 0; i < plaintext.length; i += 16) {
  459. copyArray(plaintext, block, 0, i, i + 16);
  460. block = this._aes.encrypt(block);
  461. copyArray(block, ciphertext, i);
  462. }
  463.  
  464. return ciphertext;
  465. }
  466.  
  467. ModeOfOperationECB.prototype.decrypt = function(ciphertext) {
  468. ciphertext = coerceArray(ciphertext);
  469.  
  470. if ((ciphertext.length % 16) !== 0) {
  471. throw new Error('invalid ciphertext size (must be multiple of 16 bytes)');
  472. }
  473.  
  474. var plaintext = createArray(ciphertext.length);
  475. var block = createArray(16);
  476.  
  477. for (var i = 0; i < ciphertext.length; i += 16) {
  478. copyArray(ciphertext, block, 0, i, i + 16);
  479. block = this._aes.decrypt(block);
  480. copyArray(block, plaintext, i);
  481. }
  482.  
  483. return plaintext;
  484. }
  485.  
  486.  
  487. /**
  488. * Mode Of Operation - Cipher Block Chaining (CBC)
  489. */
  490. var ModeOfOperationCBC = function(key, iv) {
  491. if (!(this instanceof ModeOfOperationCBC)) {
  492. throw Error('AES must be instanitated with `new`');
  493. }
  494.  
  495. this.description = "Cipher Block Chaining";
  496. this.name = "cbc";
  497.  
  498. if (!iv) {
  499. iv = createArray(16);
  500.  
  501. } else if (iv.length != 16) {
  502. throw new Error('invalid initialation vector size (must be 16 bytes)');
  503. }
  504.  
  505. this._lastCipherblock = coerceArray(iv, true);
  506.  
  507. this._aes = new AES(key);
  508. }
  509.  
  510. ModeOfOperationCBC.prototype.encrypt = function(plaintext) {
  511. plaintext = coerceArray(plaintext);
  512.  
  513. if ((plaintext.length % 16) !== 0) {
  514. throw new Error('invalid plaintext size (must be multiple of 16 bytes)');
  515. }
  516.  
  517. var ciphertext = createArray(plaintext.length);
  518. var block = createArray(16);
  519.  
  520. for (var i = 0; i < plaintext.length; i += 16) {
  521. copyArray(plaintext, block, 0, i, i + 16);
  522.  
  523. for (var j = 0; j < 16; j++) {
  524. block[j] ^= this._lastCipherblock[j];
  525. }
  526.  
  527. this._lastCipherblock = this._aes.encrypt(block);
  528. copyArray(this._lastCipherblock, ciphertext, i);
  529. }
  530.  
  531. return ciphertext;
  532. }
  533.  
  534. ModeOfOperationCBC.prototype.decrypt = function(ciphertext) {
  535. ciphertext = coerceArray(ciphertext);
  536.  
  537. if ((ciphertext.length % 16) !== 0) {
  538. throw new Error('invalid ciphertext size (must be multiple of 16 bytes)');
  539. }
  540.  
  541. var plaintext = createArray(ciphertext.length);
  542. var block = createArray(16);
  543.  
  544. for (var i = 0; i < ciphertext.length; i += 16) {
  545. copyArray(ciphertext, block, 0, i, i + 16);
  546. block = this._aes.decrypt(block);
  547.  
  548. for (var j = 0; j < 16; j++) {
  549. plaintext[i + j] = block[j] ^ this._lastCipherblock[j];
  550. }
  551.  
  552. copyArray(ciphertext, this._lastCipherblock, 0, i, i + 16);
  553. }
  554.  
  555. return plaintext;
  556. }
  557.  
  558.  
  559. /**
  560. * Mode Of Operation - Cipher Feedback (CFB)
  561. */
  562. var ModeOfOperationCFB = function(key, iv, segmentSize) {
  563. if (!(this instanceof ModeOfOperationCFB)) {
  564. throw Error('AES must be instanitated with `new`');
  565. }
  566.  
  567. this.description = "Cipher Feedback";
  568. this.name = "cfb";
  569.  
  570. if (!iv) {
  571. iv = createArray(16);
  572.  
  573. } else if (iv.length != 16) {
  574. throw new Error('invalid initialation vector size (must be 16 size)');
  575. }
  576.  
  577. if (!segmentSize) { segmentSize = 1; }
  578.  
  579. this.segmentSize = segmentSize;
  580.  
  581. this._shiftRegister = coerceArray(iv, true);
  582.  
  583. this._aes = new AES(key);
  584. }
  585.  
  586. ModeOfOperationCFB.prototype.encrypt = function(plaintext) {
  587. if ((plaintext.length % this.segmentSize) != 0) {
  588. throw new Error('invalid plaintext size (must be segmentSize bytes)');
  589. }
  590.  
  591. var encrypted = coerceArray(plaintext, true);
  592.  
  593. var xorSegment;
  594. for (var i = 0; i < encrypted.length; i += this.segmentSize) {
  595. xorSegment = this._aes.encrypt(this._shiftRegister);
  596. for (var j = 0; j < this.segmentSize; j++) {
  597. encrypted[i + j] ^= xorSegment[j];
  598. }
  599.  
  600. // Shift the register
  601. copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
  602. copyArray(encrypted, this._shiftRegister, 16 - this.segmentSize, i, i + this.segmentSize);
  603. }
  604.  
  605. return encrypted;
  606. }
  607.  
  608. ModeOfOperationCFB.prototype.decrypt = function(ciphertext) {
  609. if ((ciphertext.length % this.segmentSize) != 0) {
  610. throw new Error('invalid ciphertext size (must be segmentSize bytes)');
  611. }
  612.  
  613. var plaintext = coerceArray(ciphertext, true);
  614.  
  615. var xorSegment;
  616. for (var i = 0; i < plaintext.length; i += this.segmentSize) {
  617. xorSegment = this._aes.encrypt(this._shiftRegister);
  618.  
  619. for (var j = 0; j < this.segmentSize; j++) {
  620. plaintext[i + j] ^= xorSegment[j];
  621. }
  622.  
  623. // Shift the register
  624. copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
  625. copyArray(ciphertext, this._shiftRegister, 16 - this.segmentSize, i, i + this.segmentSize);
  626. }
  627.  
  628. return plaintext;
  629. }
  630.  
  631. /**
  632. * Mode Of Operation - Output Feedback (OFB)
  633. */
  634. var ModeOfOperationOFB = function(key, iv) {
  635. if (!(this instanceof ModeOfOperationOFB)) {
  636. throw Error('AES must be instanitated with `new`');
  637. }
  638.  
  639. this.description = "Output Feedback";
  640. this.name = "ofb";
  641.  
  642. if (!iv) {
  643. iv = createArray(16);
  644.  
  645. } else if (iv.length != 16) {
  646. throw new Error('invalid initialation vector size (must be 16 bytes)');
  647. }
  648.  
  649. this._lastPrecipher = coerceArray(iv, true);
  650. this._lastPrecipherIndex = 16;
  651.  
  652. this._aes = new AES(key);
  653. }
  654.  
  655. ModeOfOperationOFB.prototype.encrypt = function(plaintext) {
  656. var encrypted = coerceArray(plaintext, true);
  657.  
  658. for (var i = 0; i < encrypted.length; i++) {
  659. if (this._lastPrecipherIndex === 16) {
  660. this._lastPrecipher = this._aes.encrypt(this._lastPrecipher);
  661. this._lastPrecipherIndex = 0;
  662. }
  663. encrypted[i] ^= this._lastPrecipher[this._lastPrecipherIndex++];
  664. }
  665.  
  666. return encrypted;
  667. }
  668.  
  669. // Decryption is symetric
  670. ModeOfOperationOFB.prototype.decrypt = ModeOfOperationOFB.prototype.encrypt;
  671.  
  672.  
  673. /**
  674. * Counter object for CTR common mode of operation
  675. */
  676. var Counter = function(initialValue) {
  677. if (!(this instanceof Counter)) {
  678. throw Error('Counter must be instanitated with `new`');
  679. }
  680.  
  681. // We allow 0, but anything false-ish uses the default 1
  682. if (initialValue !== 0 && !initialValue) { initialValue = 1; }
  683.  
  684. if (typeof(initialValue) === 'number') {
  685. this._counter = createArray(16);
  686. this.setValue(initialValue);
  687.  
  688. } else {
  689. this.setBytes(initialValue);
  690. }
  691. }
  692.  
  693. Counter.prototype.setValue = function(value) {
  694. if (typeof(value) !== 'number' || parseInt(value) != value) {
  695. throw new Error('invalid counter value (must be an integer)');
  696. }
  697.  
  698. // We cannot safely handle numbers beyond the safe range for integers
  699. if (value > Number.MAX_SAFE_INTEGER) {
  700. throw new Error('integer value out of safe range');
  701. }
  702.  
  703. for (var index = 15; index >= 0; --index) {
  704. this._counter[index] = value % 256;
  705. value = parseInt(value / 256);
  706. }
  707. }
  708.  
  709. Counter.prototype.setBytes = function(bytes) {
  710. bytes = coerceArray(bytes, true);
  711.  
  712. if (bytes.length != 16) {
  713. throw new Error('invalid counter bytes size (must be 16 bytes)');
  714. }
  715.  
  716. this._counter = bytes;
  717. };
  718.  
  719. Counter.prototype.increment = function() {
  720. for (var i = 15; i >= 0; i--) {
  721. if (this._counter[i] === 255) {
  722. this._counter[i] = 0;
  723. } else {
  724. this._counter[i]++;
  725. break;
  726. }
  727. }
  728. }
  729.  
  730.  
  731. /**
  732. * Mode Of Operation - Counter (CTR)
  733. */
  734. var ModeOfOperationCTR = function(key, counter) {
  735. if (!(this instanceof ModeOfOperationCTR)) {
  736. throw Error('AES must be instanitated with `new`');
  737. }
  738.  
  739. this.description = "Counter";
  740. this.name = "ctr";
  741.  
  742. if (!(counter instanceof Counter)) {
  743. counter = new Counter(counter)
  744. }
  745.  
  746. this._counter = counter;
  747.  
  748. this._remainingCounter = null;
  749. this._remainingCounterIndex = 16;
  750.  
  751. this._aes = new AES(key);
  752. }
  753.  
  754. ModeOfOperationCTR.prototype.encrypt = function(plaintext) {
  755. var encrypted = coerceArray(plaintext, true);
  756.  
  757. for (var i = 0; i < encrypted.length; i++) {
  758. if (this._remainingCounterIndex === 16) {
  759. this._remainingCounter = this._aes.encrypt(this._counter._counter);
  760. this._remainingCounterIndex = 0;
  761. this._counter.increment();
  762. }
  763. encrypted[i] ^= this._remainingCounter[this._remainingCounterIndex++];
  764. }
  765.  
  766. return encrypted;
  767. }
  768.  
  769. // Decryption is symetric
  770. ModeOfOperationCTR.prototype.decrypt = ModeOfOperationCTR.prototype.encrypt;
  771.  
  772.  
  773. ///////////////////////
  774. // Padding
  775.  
  776. // See:https://tools.ietf.org/html/rfc2315
  777. function pkcs7pad(data) {
  778. data = coerceArray(data, true);
  779. var padder = 16 - (data.length % 16);
  780. var result = createArray(data.length + padder);
  781. copyArray(data, result);
  782. for (var i = data.length; i < result.length; i++) {
  783. result[i] = padder;
  784. }
  785. return result;
  786. }
  787.  
  788. function pkcs7strip(data) {
  789. data = coerceArray(data, true);
  790. if (data.length < 16) { throw new Error('PKCS#7 invalid length'); }
  791.  
  792. var padder = data[data.length - 1];
  793. if (padder > 16) { throw new Error('PKCS#7 padding byte out of range'); }
  794.  
  795. var length = data.length - padder;
  796. for (var i = 0; i < padder; i++) {
  797. if (data[length + i] !== padder) {
  798. throw new Error('PKCS#7 invalid padding byte');
  799. }
  800. }
  801.  
  802. var result = createArray(length);
  803. copyArray(data, result, 0, 0, length);
  804. return result;
  805. }
  806.  
  807. ///////////////////////
  808. // Exporting
  809.  
  810.  
  811. // The block cipher
  812. var aesjs = {
  813. AES: AES,
  814. Counter: Counter,
  815.  
  816. ModeOfOperation: {
  817. ecb: ModeOfOperationECB,
  818. cbc: ModeOfOperationCBC,
  819. cfb: ModeOfOperationCFB,
  820. ofb: ModeOfOperationOFB,
  821. ctr: ModeOfOperationCTR
  822. },
  823.  
  824. utils: {
  825. hex: convertHex,
  826. utf8: convertUtf8
  827. },
  828.  
  829. padding: {
  830. pkcs7: {
  831. pad: pkcs7pad,
  832. strip: pkcs7strip
  833. }
  834. },
  835.  
  836. _arrayTest: {
  837. coerceArray: coerceArray,
  838. createArray: createArray,
  839. copyArray: copyArray,
  840. }
  841. };
  842.  
  843.  
  844. // node.js
  845. if (typeof exports !== 'undefined') {
  846. module.exports = aesjs
  847.  
  848. // RequireJS/AMD
  849. // http://www.requirejs.org/docs/api.html
  850. // https://github.com/amdjs/amdjs-api/wiki/AMD
  851. } else if (typeof(define) === 'function' && define.amd) {
  852. define([], function() { return aesjs; });
  853.  
  854. // Web Browsers
  855. } else {
  856.  
  857. // If there was an existing library at "aesjs" make sure it's still available
  858. if (root.aesjs) {
  859. aesjs._aesjs = root.aesjs;
  860. }
  861.  
  862. root.aesjs = aesjs;
  863. }
  864. })(this);
  865. //end aes-js
  866.  
  867. function AESEncrypt(t,e,s){
  868. var r=aesjs.utils.utf8.toBytes(t),
  869. n=aesjs.utils.utf8.toBytes(e),
  870. u=new aesjs.ModeOfOperation.ctr(n,new aesjs.Counter(s)).encrypt(r);
  871. return aesjs.utils.hex.fromBytes(u)};
  872. function AESDecrypt(t,e,s){
  873. var r=aesjs.utils.hex.toBytes(t),
  874. n=aesjs.utils.utf8.toBytes(e),
  875. u=new aesjs.ModeOfOperation.ctr(n,new aesjs.Counter(s)).decrypt(r);
  876. return aesjs.utils.utf8.fromBytes(u)};
  877. function AESEncrypt2(plaintext, key, CTR_) {
  878. var encoded = aesjs.utils.utf8.toBytes(plaintext)
  879. var enckey = key; //NO ENCODING
  880. var counter_ = CTR_;
  881. var aesCtr = new aesjs.ModeOfOperation.ctr(enckey, new aesjs.Counter(CTR_));
  882. var encryptedBytes = aesCtr.encrypt(encoded);
  883. return aesjs.utils.hex.fromBytes(encryptedBytes);
  884. };
  885. function AESDecrypt2(ciphertext, key, CTR_) {
  886. var decoded = aesjs.utils.hex.toBytes(ciphertext)
  887. var enckey = key; //NO ENCODING
  888. var aesCtr = new aesjs.ModeOfOperation.ctr(enckey, new aesjs.Counter(CTR_));
  889. var decryptedBytes = aesCtr.decrypt(decoded);
  890. var decoded2 = aesjs.utils.utf8.fromBytes(decryptedBytes);
  891. return decoded2;
  892. };//wrapper functions
  893.  
  894. /**
  895. * [js-sha3]{@link https://github.com/emn178/js-sha3}
  896. *
  897. * @version 0.8.0
  898. * @author Chen, Yi-Cyuan [emn178@gmail.com]
  899. * @copyright Chen, Yi-Cyuan 2015-2018
  900. * @license MIT
  901. */
  902. /*jslint bitwise: true */
  903. (function () {
  904. 'use strict';
  905.  
  906. var INPUT_ERROR = 'input is invalid type';
  907. var FINALIZE_ERROR = 'finalize already called';
  908. var WINDOW = typeof window === 'object';
  909. var root = WINDOW ? window : {};
  910. if (root.JS_SHA3_NO_WINDOW) {
  911. WINDOW = false;
  912. }
  913. var WEB_WORKER = !WINDOW && typeof self === 'object';
  914. var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;
  915. if (NODE_JS) {
  916. root = global;
  917. } else if (WEB_WORKER) {
  918. root = self;
  919. }
  920. var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && typeof module === 'object' && module.exports;
  921. var AMD = typeof define === 'function' && define.amd;
  922. var ARRAY_BUFFER = !root.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined';
  923. var HEX_CHARS = '0123456789abcdef'.split('');
  924. var SHAKE_PADDING = [31, 7936, 2031616, 520093696];
  925. var CSHAKE_PADDING = [4, 1024, 262144, 67108864];
  926. var KECCAK_PADDING = [1, 256, 65536, 16777216];
  927. var PADDING = [6, 1536, 393216, 100663296];
  928. var SHIFT = [0, 8, 16, 24];
  929. var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649,
  930. 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0,
  931. 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771,
  932. 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648,
  933. 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648];
  934. var BITS = [224, 256, 384, 512];
  935. var SHAKE_BITS = [128, 256];
  936. var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array', 'digest'];
  937. var CSHAKE_BYTEPAD = {
  938. '128': 168,
  939. '256': 136
  940. };
  941.  
  942. if (root.JS_SHA3_NO_NODE_JS || !Array.isArray) {
  943. Array.isArray = function (obj) {
  944. return Object.prototype.toString.call(obj) === '[object Array]';
  945. };
  946. }
  947.  
  948. if (ARRAY_BUFFER && (root.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) {
  949. ArrayBuffer.isView = function (obj) {
  950. return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer;
  951. };
  952. }
  953.  
  954. var createOutputMethod = function (bits, padding, outputType) {
  955. return function (message) {
  956. return new Keccak(bits, padding, bits).update(message)[outputType]();
  957. };
  958. };
  959.  
  960. var createShakeOutputMethod = function (bits, padding, outputType) {
  961. return function (message, outputBits) {
  962. return new Keccak(bits, padding, outputBits).update(message)[outputType]();
  963. };
  964. };
  965.  
  966. var createCshakeOutputMethod = function (bits, padding, outputType) {
  967. return function (message, outputBits, n, s) {
  968. return methods['cshake' + bits].update(message, outputBits, n, s)[outputType]();
  969. };
  970. };
  971.  
  972. var createKmacOutputMethod = function (bits, padding, outputType) {
  973. return function (key, message, outputBits, s) {
  974. return methods['kmac' + bits].update(key, message, outputBits, s)[outputType]();
  975. };
  976. };
  977.  
  978. var createOutputMethods = function (method, createMethod, bits, padding) {
  979. for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
  980. var type = OUTPUT_TYPES[i];
  981. method[type] = createMethod(bits, padding, type);
  982. }
  983. return method;
  984. };
  985.  
  986. var createMethod = function (bits, padding) {
  987. var method = createOutputMethod(bits, padding, 'hex');
  988. method.create = function () {
  989. return new Keccak(bits, padding, bits);
  990. };
  991. method.update = function (message) {
  992. return method.create().update(message);
  993. };
  994. return createOutputMethods(method, createOutputMethod, bits, padding);
  995. };
  996.  
  997. var createShakeMethod = function (bits, padding) {
  998. var method = createShakeOutputMethod(bits, padding, 'hex');
  999. method.create = function (outputBits) {
  1000. return new Keccak(bits, padding, outputBits);
  1001. };
  1002. method.update = function (message, outputBits) {
  1003. return method.create(outputBits).update(message);
  1004. };
  1005. return createOutputMethods(method, createShakeOutputMethod, bits, padding);
  1006. };
  1007.  
  1008. var createCshakeMethod = function (bits, padding) {
  1009. var w = CSHAKE_BYTEPAD[bits];
  1010. var method = createCshakeOutputMethod(bits, padding, 'hex');
  1011. method.create = function (outputBits, n, s) {
  1012. if (!n && !s) {
  1013. return methods['shake' + bits].create(outputBits);
  1014. } else {
  1015. return new Keccak(bits, padding, outputBits).bytepad([n, s], w);
  1016. }
  1017. };
  1018. method.update = function (message, outputBits, n, s) {
  1019. return method.create(outputBits, n, s).update(message);
  1020. };
  1021. return createOutputMethods(method, createCshakeOutputMethod, bits, padding);
  1022. };
  1023.  
  1024. var createKmacMethod = function (bits, padding) {
  1025. var w = CSHAKE_BYTEPAD[bits];
  1026. var method = createKmacOutputMethod(bits, padding, 'hex');
  1027. method.create = function (key, outputBits, s) {
  1028. return new Kmac(bits, padding, outputBits).bytepad(['KMAC', s], w).bytepad([key], w);
  1029. };
  1030. method.update = function (key, message, outputBits, s) {
  1031. return method.create(key, outputBits, s).update(message);
  1032. };
  1033. return createOutputMethods(method, createKmacOutputMethod, bits, padding);
  1034. };
  1035.  
  1036. var algorithms = [
  1037. { name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod },
  1038. { name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod },
  1039. { name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod },
  1040. { name: 'cshake', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createCshakeMethod },
  1041. { name: 'kmac', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod }
  1042. ];
  1043.  
  1044. var methods = {}, methodNames = [];
  1045.  
  1046. for (var i = 0; i < algorithms.length; ++i) {
  1047. var algorithm = algorithms[i];
  1048. var bits = algorithm.bits;
  1049. for (var j = 0; j < bits.length; ++j) {
  1050. var methodName = algorithm.name + '_' + bits[j];
  1051. methodNames.push(methodName);
  1052. methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding);
  1053. if (algorithm.name !== 'sha3') {
  1054. var newMethodName = algorithm.name + bits[j];
  1055. methodNames.push(newMethodName);
  1056. methods[newMethodName] = methods[methodName];
  1057. }
  1058. }
  1059. }
  1060.  
  1061. function Keccak(bits, padding, outputBits) {
  1062. this.blocks = [];
  1063. this.s = [];
  1064. this.padding = padding;
  1065. this.outputBits = outputBits;
  1066. this.reset = true;
  1067. this.finalized = false;
  1068. this.block = 0;
  1069. this.start = 0;
  1070. this.blockCount = (1600 - (bits << 1)) >> 5;
  1071. this.byteCount = this.blockCount << 2;
  1072. this.outputBlocks = outputBits >> 5;
  1073. this.extraBytes = (outputBits & 31) >> 3;
  1074.  
  1075. for (var i = 0; i < 50; ++i) {
  1076. this.s[i] = 0;
  1077. }
  1078. }
  1079.  
  1080. Keccak.prototype.update = function (message) {
  1081. if (this.finalized) {
  1082. throw new Error(FINALIZE_ERROR);
  1083. }
  1084. var notString, type = typeof message;
  1085. if (type !== 'string') {
  1086. if (type === 'object') {
  1087. if (message === null) {
  1088. throw new Error(INPUT_ERROR);
  1089. } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {
  1090. message = new Uint8Array(message);
  1091. } else if (!Array.isArray(message)) {
  1092. if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) {
  1093. throw new Error(INPUT_ERROR);
  1094. }
  1095. }
  1096. } else {
  1097. throw new Error(INPUT_ERROR);
  1098. }
  1099. notString = true;
  1100. }
  1101. var blocks = this.blocks, byteCount = this.byteCount, length = message.length,
  1102. blockCount = this.blockCount, index = 0, s = this.s, i, code;
  1103.  
  1104. while (index < length) {
  1105. if (this.reset) {
  1106. this.reset = false;
  1107. blocks[0] = this.block;
  1108. for (i = 1; i < blockCount + 1; ++i) {
  1109. blocks[i] = 0;
  1110. }
  1111. }
  1112. if (notString) {
  1113. for (i = this.start; index < length && i < byteCount; ++index) {
  1114. blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];
  1115. }
  1116. } else {
  1117. for (i = this.start; index < length && i < byteCount; ++index) {
  1118. code = message.charCodeAt(index);
  1119. if (code < 0x80) {
  1120. blocks[i >> 2] |= code << SHIFT[i++ & 3];
  1121. } else if (code < 0x800) {
  1122. blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3];
  1123. blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
  1124. } else if (code < 0xd800 || code >= 0xe000) {
  1125. blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3];
  1126. blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];
  1127. blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
  1128. } else {
  1129. code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));
  1130. blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3];
  1131. blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3];
  1132. blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];
  1133. blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
  1134. }
  1135. }
  1136. }
  1137. this.lastByteIndex = i;
  1138. if (i >= byteCount) {
  1139. this.start = i - byteCount;
  1140. this.block = blocks[blockCount];
  1141. for (i = 0; i < blockCount; ++i) {
  1142. s[i] ^= blocks[i];
  1143. }
  1144. f(s);
  1145. this.reset = true;
  1146. } else {
  1147. this.start = i;
  1148. }
  1149. }
  1150. return this;
  1151. };
  1152.  
  1153. Keccak.prototype.encode = function (x, right) {
  1154. var o = x & 255, n = 1;
  1155. var bytes = [o];
  1156. x = x >> 8;
  1157. o = x & 255;
  1158. while (o > 0) {
  1159. bytes.unshift(o);
  1160. x = x >> 8;
  1161. o = x & 255;
  1162. ++n;
  1163. }
  1164. if (right) {
  1165. bytes.push(n);
  1166. } else {
  1167. bytes.unshift(n);
  1168. }
  1169. this.update(bytes);
  1170. return bytes.length;
  1171. };
  1172.  
  1173. Keccak.prototype.encodeString = function (str) {
  1174. var notString, type = typeof str;
  1175. if (type !== 'string') {
  1176. if (type === 'object') {
  1177. if (str === null) {
  1178. throw new Error(INPUT_ERROR);
  1179. } else if (ARRAY_BUFFER && str.constructor === ArrayBuffer) {
  1180. str = new Uint8Array(str);
  1181. } else if (!Array.isArray(str)) {
  1182. if (!ARRAY_BUFFER || !ArrayBuffer.isView(str)) {
  1183. throw new Error(INPUT_ERROR);
  1184. }
  1185. }
  1186. } else {
  1187. throw new Error(INPUT_ERROR);
  1188. }
  1189. notString = true;
  1190. }
  1191. var bytes = 0, length = str.length;
  1192. if (notString) {
  1193. bytes = length;
  1194. } else {
  1195. for (var i = 0; i < str.length; ++i) {
  1196. var code = str.charCodeAt(i);
  1197. if (code < 0x80) {
  1198. bytes += 1;
  1199. } else if (code < 0x800) {
  1200. bytes += 2;
  1201. } else if (code < 0xd800 || code >= 0xe000) {
  1202. bytes += 3;
  1203. } else {
  1204. code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(++i) & 0x3ff));
  1205. bytes += 4;
  1206. }
  1207. }
  1208. }
  1209. bytes += this.encode(bytes * 8);
  1210. this.update(str);
  1211. return bytes;
  1212. };
  1213.  
  1214. Keccak.prototype.bytepad = function (strs, w) {
  1215. var bytes = this.encode(w);
  1216. for (var i = 0; i < strs.length; ++i) {
  1217. bytes += this.encodeString(strs[i]);
  1218. }
  1219. var paddingBytes = w - bytes % w;
  1220. var zeros = [];
  1221. zeros.length = paddingBytes;
  1222. this.update(zeros);
  1223. return this;
  1224. };
  1225.  
  1226. Keccak.prototype.finalize = function () {
  1227. if (this.finalized) {
  1228. return;
  1229. }
  1230. this.finalized = true;
  1231. var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s;
  1232. blocks[i >> 2] |= this.padding[i & 3];
  1233. if (this.lastByteIndex === this.byteCount) {
  1234. blocks[0] = blocks[blockCount];
  1235. for (i = 1; i < blockCount + 1; ++i) {
  1236. blocks[i] = 0;
  1237. }
  1238. }
  1239. blocks[blockCount - 1] |= 0x80000000;
  1240. for (i = 0; i < blockCount; ++i) {
  1241. s[i] ^= blocks[i];
  1242. }
  1243. f(s);
  1244. };
  1245.  
  1246. Keccak.prototype.toString = Keccak.prototype.hex = function () {
  1247. this.finalize();
  1248.  
  1249. var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,
  1250. extraBytes = this.extraBytes, i = 0, j = 0;
  1251. var hex = '', block;
  1252. while (j < outputBlocks) {
  1253. for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {
  1254. block = s[i];
  1255. hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] +
  1256. HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] +
  1257. HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] +
  1258. HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F];
  1259. }
  1260. if (j % blockCount === 0) {
  1261. f(s);
  1262. i = 0;
  1263. }
  1264. }
  1265. if (extraBytes) {
  1266. block = s[i];
  1267. hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F];
  1268. if (extraBytes > 1) {
  1269. hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F];
  1270. }
  1271. if (extraBytes > 2) {
  1272. hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F];
  1273. }
  1274. }
  1275. return hex;
  1276. };
  1277.  
  1278. Keccak.prototype.arrayBuffer = function () {
  1279. this.finalize();
  1280.  
  1281. var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,
  1282. extraBytes = this.extraBytes, i = 0, j = 0;
  1283. var bytes = this.outputBits >> 3;
  1284. var buffer;
  1285. if (extraBytes) {
  1286. buffer = new ArrayBuffer((outputBlocks + 1) << 2);
  1287. } else {
  1288. buffer = new ArrayBuffer(bytes);
  1289. }
  1290. var array = new Uint32Array(buffer);
  1291. while (j < outputBlocks) {
  1292. for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {
  1293. array[j] = s[i];
  1294. }
  1295. if (j % blockCount === 0) {
  1296. f(s);
  1297. }
  1298. }
  1299. if (extraBytes) {
  1300. array[i] = s[i];
  1301. buffer = buffer.slice(0, bytes);
  1302. }
  1303. return buffer;
  1304. };
  1305.  
  1306. Keccak.prototype.buffer = Keccak.prototype.arrayBuffer;
  1307.  
  1308. Keccak.prototype.digest = Keccak.prototype.array = function () {
  1309. this.finalize();
  1310.  
  1311. var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,
  1312. extraBytes = this.extraBytes, i = 0, j = 0;
  1313. var array = [], offset, block;
  1314. while (j < outputBlocks) {
  1315. for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {
  1316. offset = j << 2;
  1317. block = s[i];
  1318. array[offset] = block & 0xFF;
  1319. array[offset + 1] = (block >> 8) & 0xFF;
  1320. array[offset + 2] = (block >> 16) & 0xFF;
  1321. array[offset + 3] = (block >> 24) & 0xFF;
  1322. }
  1323. if (j % blockCount === 0) {
  1324. f(s);
  1325. }
  1326. }
  1327. if (extraBytes) {
  1328. offset = j << 2;
  1329. block = s[i];
  1330. array[offset] = block & 0xFF;
  1331. if (extraBytes > 1) {
  1332. array[offset + 1] = (block >> 8) & 0xFF;
  1333. }
  1334. if (extraBytes > 2) {
  1335. array[offset + 2] = (block >> 16) & 0xFF;
  1336. }
  1337. }
  1338. return array;
  1339. };
  1340.  
  1341. function Kmac(bits, padding, outputBits) {
  1342. Keccak.call(this, bits, padding, outputBits);
  1343. }
  1344.  
  1345. Kmac.prototype = new Keccak();
  1346.  
  1347. Kmac.prototype.finalize = function () {
  1348. this.encode(this.outputBits, true);
  1349. return Keccak.prototype.finalize.call(this);
  1350. };
  1351.  
  1352. var f = function (s) {
  1353. var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9,
  1354. b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17,
  1355. b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33,
  1356. b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49;
  1357. for (n = 0; n < 48; n += 2) {
  1358. c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40];
  1359. c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41];
  1360. c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42];
  1361. c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43];
  1362. c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44];
  1363. c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45];
  1364. c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46];
  1365. c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47];
  1366. c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48];
  1367. c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49];
  1368.  
  1369. h = c8 ^ ((c2 << 1) | (c3 >>> 31));
  1370. l = c9 ^ ((c3 << 1) | (c2 >>> 31));
  1371. s[0] ^= h;
  1372. s[1] ^= l;
  1373. s[10] ^= h;
  1374. s[11] ^= l;
  1375. s[20] ^= h;
  1376. s[21] ^= l;
  1377. s[30] ^= h;
  1378. s[31] ^= l;
  1379. s[40] ^= h;
  1380. s[41] ^= l;
  1381. h = c0 ^ ((c4 << 1) | (c5 >>> 31));
  1382. l = c1 ^ ((c5 << 1) | (c4 >>> 31));
  1383. s[2] ^= h;
  1384. s[3] ^= l;
  1385. s[12] ^= h;
  1386. s[13] ^= l;
  1387. s[22] ^= h;
  1388. s[23] ^= l;
  1389. s[32] ^= h;
  1390. s[33] ^= l;
  1391. s[42] ^= h;
  1392. s[43] ^= l;
  1393. h = c2 ^ ((c6 << 1) | (c7 >>> 31));
  1394. l = c3 ^ ((c7 << 1) | (c6 >>> 31));
  1395. s[4] ^= h;
  1396. s[5] ^= l;
  1397. s[14] ^= h;
  1398. s[15] ^= l;
  1399. s[24] ^= h;
  1400. s[25] ^= l;
  1401. s[34] ^= h;
  1402. s[35] ^= l;
  1403. s[44] ^= h;
  1404. s[45] ^= l;
  1405. h = c4 ^ ((c8 << 1) | (c9 >>> 31));
  1406. l = c5 ^ ((c9 << 1) | (c8 >>> 31));
  1407. s[6] ^= h;
  1408. s[7] ^= l;
  1409. s[16] ^= h;
  1410. s[17] ^= l;
  1411. s[26] ^= h;
  1412. s[27] ^= l;
  1413. s[36] ^= h;
  1414. s[37] ^= l;
  1415. s[46] ^= h;
  1416. s[47] ^= l;
  1417. h = c6 ^ ((c0 << 1) | (c1 >>> 31));
  1418. l = c7 ^ ((c1 << 1) | (c0 >>> 31));
  1419. s[8] ^= h;
  1420. s[9] ^= l;
  1421. s[18] ^= h;
  1422. s[19] ^= l;
  1423. s[28] ^= h;
  1424. s[29] ^= l;
  1425. s[38] ^= h;
  1426. s[39] ^= l;
  1427. s[48] ^= h;
  1428. s[49] ^= l;
  1429.  
  1430. b0 = s[0];
  1431. b1 = s[1];
  1432. b32 = (s[11] << 4) | (s[10] >>> 28);
  1433. b33 = (s[10] << 4) | (s[11] >>> 28);
  1434. b14 = (s[20] << 3) | (s[21] >>> 29);
  1435. b15 = (s[21] << 3) | (s[20] >>> 29);
  1436. b46 = (s[31] << 9) | (s[30] >>> 23);
  1437. b47 = (s[30] << 9) | (s[31] >>> 23);
  1438. b28 = (s[40] << 18) | (s[41] >>> 14);
  1439. b29 = (s[41] << 18) | (s[40] >>> 14);
  1440. b20 = (s[2] << 1) | (s[3] >>> 31);
  1441. b21 = (s[3] << 1) | (s[2] >>> 31);
  1442. b2 = (s[13] << 12) | (s[12] >>> 20);
  1443. b3 = (s[12] << 12) | (s[13] >>> 20);
  1444. b34 = (s[22] << 10) | (s[23] >>> 22);
  1445. b35 = (s[23] << 10) | (s[22] >>> 22);
  1446. b16 = (s[33] << 13) | (s[32] >>> 19);
  1447. b17 = (s[32] << 13) | (s[33] >>> 19);
  1448. b48 = (s[42] << 2) | (s[43] >>> 30);
  1449. b49 = (s[43] << 2) | (s[42] >>> 30);
  1450. b40 = (s[5] << 30) | (s[4] >>> 2);
  1451. b41 = (s[4] << 30) | (s[5] >>> 2);
  1452. b22 = (s[14] << 6) | (s[15] >>> 26);
  1453. b23 = (s[15] << 6) | (s[14] >>> 26);
  1454. b4 = (s[25] << 11) | (s[24] >>> 21);
  1455. b5 = (s[24] << 11) | (s[25] >>> 21);
  1456. b36 = (s[34] << 15) | (s[35] >>> 17);
  1457. b37 = (s[35] << 15) | (s[34] >>> 17);
  1458. b18 = (s[45] << 29) | (s[44] >>> 3);
  1459. b19 = (s[44] << 29) | (s[45] >>> 3);
  1460. b10 = (s[6] << 28) | (s[7] >>> 4);
  1461. b11 = (s[7] << 28) | (s[6] >>> 4);
  1462. b42 = (s[17] << 23) | (s[16] >>> 9);
  1463. b43 = (s[16] << 23) | (s[17] >>> 9);
  1464. b24 = (s[26] << 25) | (s[27] >>> 7);
  1465. b25 = (s[27] << 25) | (s[26] >>> 7);
  1466. b6 = (s[36] << 21) | (s[37] >>> 11);
  1467. b7 = (s[37] << 21) | (s[36] >>> 11);
  1468. b38 = (s[47] << 24) | (s[46] >>> 8);
  1469. b39 = (s[46] << 24) | (s[47] >>> 8);
  1470. b30 = (s[8] << 27) | (s[9] >>> 5);
  1471. b31 = (s[9] << 27) | (s[8] >>> 5);
  1472. b12 = (s[18] << 20) | (s[19] >>> 12);
  1473. b13 = (s[19] << 20) | (s[18] >>> 12);
  1474. b44 = (s[29] << 7) | (s[28] >>> 25);
  1475. b45 = (s[28] << 7) | (s[29] >>> 25);
  1476. b26 = (s[38] << 8) | (s[39] >>> 24);
  1477. b27 = (s[39] << 8) | (s[38] >>> 24);
  1478. b8 = (s[48] << 14) | (s[49] >>> 18);
  1479. b9 = (s[49] << 14) | (s[48] >>> 18);
  1480.  
  1481. s[0] = b0 ^ (~b2 & b4);
  1482. s[1] = b1 ^ (~b3 & b5);
  1483. s[10] = b10 ^ (~b12 & b14);
  1484. s[11] = b11 ^ (~b13 & b15);
  1485. s[20] = b20 ^ (~b22 & b24);
  1486. s[21] = b21 ^ (~b23 & b25);
  1487. s[30] = b30 ^ (~b32 & b34);
  1488. s[31] = b31 ^ (~b33 & b35);
  1489. s[40] = b40 ^ (~b42 & b44);
  1490. s[41] = b41 ^ (~b43 & b45);
  1491. s[2] = b2 ^ (~b4 & b6);
  1492. s[3] = b3 ^ (~b5 & b7);
  1493. s[12] = b12 ^ (~b14 & b16);
  1494. s[13] = b13 ^ (~b15 & b17);
  1495. s[22] = b22 ^ (~b24 & b26);
  1496. s[23] = b23 ^ (~b25 & b27);
  1497. s[32] = b32 ^ (~b34 & b36);
  1498. s[33] = b33 ^ (~b35 & b37);
  1499. s[42] = b42 ^ (~b44 & b46);
  1500. s[43] = b43 ^ (~b45 & b47);
  1501. s[4] = b4 ^ (~b6 & b8);
  1502. s[5] = b5 ^ (~b7 & b9);
  1503. s[14] = b14 ^ (~b16 & b18);
  1504. s[15] = b15 ^ (~b17 & b19);
  1505. s[24] = b24 ^ (~b26 & b28);
  1506. s[25] = b25 ^ (~b27 & b29);
  1507. s[34] = b34 ^ (~b36 & b38);
  1508. s[35] = b35 ^ (~b37 & b39);
  1509. s[44] = b44 ^ (~b46 & b48);
  1510. s[45] = b45 ^ (~b47 & b49);
  1511. s[6] = b6 ^ (~b8 & b0);
  1512. s[7] = b7 ^ (~b9 & b1);
  1513. s[16] = b16 ^ (~b18 & b10);
  1514. s[17] = b17 ^ (~b19 & b11);
  1515. s[26] = b26 ^ (~b28 & b20);
  1516. s[27] = b27 ^ (~b29 & b21);
  1517. s[36] = b36 ^ (~b38 & b30);
  1518. s[37] = b37 ^ (~b39 & b31);
  1519. s[46] = b46 ^ (~b48 & b40);
  1520. s[47] = b47 ^ (~b49 & b41);
  1521. s[8] = b8 ^ (~b0 & b2);
  1522. s[9] = b9 ^ (~b1 & b3);
  1523. s[18] = b18 ^ (~b10 & b12);
  1524. s[19] = b19 ^ (~b11 & b13);
  1525. s[28] = b28 ^ (~b20 & b22);
  1526. s[29] = b29 ^ (~b21 & b23);
  1527. s[38] = b38 ^ (~b30 & b32);
  1528. s[39] = b39 ^ (~b31 & b33);
  1529. s[48] = b48 ^ (~b40 & b42);
  1530. s[49] = b49 ^ (~b41 & b43);
  1531.  
  1532. s[0] ^= RC[n];
  1533. s[1] ^= RC[n + 1];
  1534. }
  1535. };
  1536.  
  1537. if (COMMON_JS) {
  1538. module.exports = methods;
  1539. } else {
  1540. for (i = 0; i < methodNames.length; ++i) {
  1541. root[methodNames[i]] = methods[methodNames[i]];
  1542. }
  1543. if (AMD) {
  1544. define(function () {
  1545. return methods;
  1546. });
  1547. }
  1548. }
  1549. })();
  1550.  
  1551. function Decodeuint8arr(e){return new TextDecoder("utf-8").decode(e)}function Encodeuint8arr(e){return new TextEncoder("utf-8").encode(e)}
  1552. //uint8 encoder and decoder from: https://ourcodeworld.com/articles/read/164/how-to-convert-an-uint8array-to-string-in-javascript
  1553.  
  1554. //start https://www.darkwavetech.com/index.php/device-fingerprint-blog/ functions
  1555. function clock(){'use strict';var r=0,c=0,o=0;try{for(r=performance.now()/1e3,c=performance.now()/1e3-r,o=0;o<20;o++)c=clockcalc(c,performance.now()/1e3-r);return'<clkMHz>'+Math.round(1/c)+'</clkMHz>'}catch(r){return'<clkhz>error</clkhz>'}}function clockcalc(r,c){lngOnError=0;try{return r<1e-8?c:r<c?clockcalc(c-Math.floor(c/r)*r,r):r==c?r:clockcalc(c,r)}catch(r){return lngOnError}}function mode(r){if(0==r.length)return null;for(var c={},o=r[0],n=1,e=0;e<r.length;e++){var l=r[e];null==c[l]?c[l]=1:c[l]++,c[l]>n&&(n=c[o=l])}return o}function getClockSpeed(){for(var r=[],c=0;c<30;c++)r.push(Number(clock().slice(8,-9)));return mode(r)};
  1556. //clock speed
  1557.  
  1558. function sStorage() {
  1559. "use strict";
  1560. var strOnError, strOut;
  1561.  
  1562. strOnError = "<sessionstorage>true</sessionstorage>";
  1563. strOut = "";
  1564.  
  1565. try {
  1566. strOut = "<sessionstorage>" + !!window.sessionStorage + "</sessionstorage>";
  1567. return strOut;
  1568. } catch (err) { // Error when referencing it confirms existence
  1569. return strOnError;
  1570. };
  1571. };
  1572.  
  1573. function inxDB() {
  1574. "use strict";
  1575. var strOnError, strOut;
  1576.  
  1577. strOnError = "<indexedDB>true</indexedDB>";
  1578. strOut = "";
  1579.  
  1580. try {
  1581. strOut = "<indexedDB>" + !!window.indexedDB + "</indexedDB>";
  1582. return strOut;
  1583. } catch (err) { // Error when referencing it confirms existence
  1584. return strOnError;
  1585. };
  1586. };
  1587.  
  1588. function timezone() {
  1589. "use strict";
  1590. var strOnError, dtDate1, dtDate2, strOffset1, strOffset2, strOut;
  1591.  
  1592. strOnError = "<timezone>Error</timezone>";
  1593. dtDate1 = null;
  1594. dtDate2 = null;
  1595. strOffset1 = "";
  1596. strOffset2 = "";
  1597. strOut = "";
  1598.  
  1599. try {
  1600. dtDate1 = new Date(2018, 0, 1);
  1601. dtDate2 = new Date(2018, 6, 1);
  1602. strOffset1 = dtDate1.getTimezoneOffset();
  1603. strOffset2 = dtDate2.getTimezoneOffset();
  1604. strOut = "<timezone>" + strOffset1 + "|" + strOffset2 + "</timezone>";
  1605. return strOut;
  1606. } catch (err) {
  1607. return strOnError;
  1608. }
  1609. };
  1610.  
  1611. function mathroutines() {
  1612. "use strict";
  1613. var strOnError, strOut;
  1614.  
  1615. strOnError = "<mathroutines>Error</mathroutines>";
  1616. strOut = "";
  1617.  
  1618. try {
  1619. strOut = "<mathroutines>" + ((Math.exp(10) + 1 / Math.exp(10)) / 2) + "|" + Math.tan(-1e300) + "</mathroutines>";
  1620. return strOut;
  1621. } catch (err) {
  1622. return strOnError;
  1623. }
  1624. };
  1625.  
  1626. function nav() {
  1627. "use strict";
  1628.  
  1629. var strOnError, strKey, Value, strValue, strTmp, strOut;
  1630.  
  1631. strOnError = "Error";
  1632. strKey = "";
  1633. Value = "";
  1634. strValue = "";
  1635. strTmp = "";
  1636. strOut = "";
  1637.  
  1638. try {
  1639. for (strKey in navigator) {
  1640. Value = navigator[strKey];
  1641. if (Value === null || (typeof Value !== "function" && typeof Value !== "object")) {
  1642. strValue = String(Value);
  1643. if (strValue === "null") {
  1644. strValue = "NULL";
  1645. }
  1646. if (strValue === "") {
  1647. strValue = "_";
  1648. }
  1649. strTmp = strTmp + "<" + strKey + ">" + strValue + "</" + strKey + ">";
  1650. }
  1651. }
  1652. strOut = strTmp.slice(0, strTmp.length - 1);
  1653. return strOut + ">";
  1654. } catch (err) {
  1655. return strOnError;
  1656. }
  1657. };
  1658.  
  1659. function tryToGenIF(url_) {
  1660. let iframe = document.createElement('iframe');
  1661. iframe.src = url_;
  1662. iframe.style["width"] = "0px";
  1663. iframe.style["height"] = "0px";
  1664. iframe.height = "0px";
  1665. iframe.width = "0px";
  1666. iframe.tabindex = -1;
  1667. iframe.title = "empty";
  1668. iframe.style["display"] = "none";
  1669. document.documentElement.appendChild(iframe);
  1670. };
  1671.  
  1672. function forceHTTPS() { //network and http(s) test
  1673. let fHTTPSval;
  1674. try {
  1675. tryToGenIF("https://web.archive.org/web/20221121180058/https://ksw2-center.glitch.me/global/blank");
  1676. tryToGenIF("https://web.archive.org/web/20221121180058/http://ksw2-center.glitch.me/global/blank");
  1677. fHTTPSval = true;
  1678. } catch(e){
  1679. fHTTPSval = false;
  1680. };
  1681. return "<fhttps>" + fHTTPSval + "</fhttps>";
  1682. };
  1683.  
  1684. function canvas() {
  1685. "use strict";
  1686. var strOnError, canvas, strCText, strText, strOut;
  1687.  
  1688. strOnError = "Error";
  1689. canvas = null;
  1690. strCText = null;
  1691. strText = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~1!2@3#4$5%6^7&8*9(0)-_=+[{]}|;:',<.>/?";
  1692. strOut = null;
  1693.  
  1694. try {
  1695. canvas = document.createElement('canvas');
  1696. strCText = canvas.getContext('2d');
  1697. strCText.textBaseline = "top";
  1698. strCText.font = "14px 'Arial'";
  1699. strCText.textBaseline = "alphabetic";
  1700. strCText.fillStyle = "#f60";
  1701. strCText.fillRect(125, 1, 62, 20);
  1702. strCText.fillStyle = "#069";
  1703. strCText.fillText(strText, 2, 15);
  1704. strCText.fillStyle = "rgba(102, 204, 0, 0.7)";
  1705. strCText.fillText(strText, 4, 17);
  1706. strOut = sha3_512(canvas.toDataURL());
  1707. return strOut;
  1708. } catch (err) {
  1709. return strOnError;
  1710. };
  1711. };
  1712.  
  1713. function perf() {
  1714. "use strict";
  1715.  
  1716. var strOnError, strKey, Value, strValue, strTmp, strOut;
  1717.  
  1718. strOnError = "Error";
  1719. strKey = "";
  1720. Value = "";
  1721. strValue = "";
  1722. strTmp = "";
  1723. strOut = "";
  1724.  
  1725. try {
  1726. for (strKey in performance) {
  1727. Value = performance[strKey];
  1728. if (Value === null || (typeof Value !== "function" && typeof Value !== "object")) {
  1729. strValue = String(Value);
  1730. if (strValue === "null") {
  1731. strValue = "NULL";
  1732. }
  1733. if (strValue === "") {
  1734. strValue = "_";
  1735. }
  1736. strTmp = strTmp + "<" + strKey + ">" + strValue + "</" + strKey + ">";
  1737. }
  1738. }
  1739. strOut = strTmp.slice(0, strTmp.length - 1);
  1740. return strOut + ">";
  1741. } catch (err) {
  1742. return strOnError;
  1743. }
  1744. };
  1745.  
  1746. function naviTimes() {
  1747. "use strict";
  1748.  
  1749. var strOnError, strKey, Value, strValue, strTmp, strOut;
  1750.  
  1751. strOnError = "Error";
  1752. strKey = "";
  1753. Value = "";
  1754. strValue = "";
  1755. strTmp = "";
  1756. strOut = "";
  1757.  
  1758. try {
  1759. for (strKey in performance.timing) {
  1760. Value = performance.timing[strKey];
  1761. if (Value === null || (typeof Value !== "function" && typeof Value !== "object")) {
  1762. strValue = String(Value);
  1763. if (strValue === "null") {
  1764. strValue = "NULL";
  1765. }
  1766. if (strValue === "") {
  1767. strValue = "_";
  1768. }
  1769. strTmp = strTmp + "<" + strKey + ">" + strValue + "</" + strKey + ">";
  1770. }
  1771. }
  1772. strOut = strTmp.slice(0, strTmp.length - 1);
  1773. return strOut + ">";
  1774. } catch (err) {
  1775. return strOnError;
  1776. }
  1777. };
  1778.  
  1779. function languages() {
  1780. "use strict";
  1781. var strSep, strOnError, strLang, strOut;
  1782.  
  1783. strSep = "|";
  1784. strOnError = "Error";
  1785. strLang = "";
  1786. strOut = "";
  1787.  
  1788. try {
  1789. if (navigator.language) {
  1790. strLang = "lang=" + navigator.language + strSep;
  1791. } else {
  1792. strLang = "lang=" + "undefined" + strSep;
  1793. }
  1794. if (navigator.languages) {
  1795. strLang = strLang + "langs=" + navigator.languages + strSep;
  1796. } else {
  1797. strLang = strLang + "langs=" + "undefined" + strSep;
  1798. }
  1799. // Microsoft specific properties
  1800. if (navigator.browserLanguage) {
  1801. strLang = strLang + "brlang=" + navigator.browserLanguage + strSep;
  1802. } else {
  1803. strLang = strLang + "brlang=" + "undefined" + strSep;
  1804. }
  1805. if (navigator.systemLanguage) {
  1806. strLang = strLang + "syslang=" + navigator.systemLanguage + strSep;
  1807. } else {
  1808. strLang = strLang + "syslang=" + "undefined" + strSep;
  1809. }
  1810. if (navigator.userLanguage) {
  1811. strLang = strLang + "usrlang=" + navigator.userLanguage;
  1812. } else {
  1813. strLang = strLang + "usrlang=" + "undefined";
  1814. }
  1815. strOut = strLang;
  1816. return "<lang>" + strOut + "</lang>";
  1817. } catch (err) {
  1818. return strOnError;
  1819. };
  1820. };
  1821.  
  1822. function java() {
  1823. "use strict";
  1824. var strOnError, strJavaEnabled, strOut;
  1825.  
  1826. strOnError = "Error";
  1827. strJavaEnabled = null;
  1828. strOut = null;
  1829.  
  1830. try {
  1831. if (navigator.javaEnabled()) {
  1832. strJavaEnabled = "true";
  1833. } else {
  1834. strJavaEnabled = "false";
  1835. }
  1836. strOut = strJavaEnabled;
  1837. return "<java>" + strOut + "</java>";
  1838. } catch (err) {
  1839. return strOnError;
  1840. };
  1841. };
  1842.  
  1843. function scr() {
  1844. "use strict";
  1845.  
  1846. var strOnError, strKey, Value, strValue, strTmp, strOut;
  1847.  
  1848. strOnError = "Error";
  1849. strKey = "";
  1850. Value = "";
  1851. strValue = "";
  1852. strTmp = "";
  1853. strOut = "";
  1854.  
  1855. try {
  1856. for (strKey in screen) {
  1857. Value = screen[strKey];
  1858. if (Value === null || (typeof Value !== "function" && typeof Value !== "object")) {
  1859. strValue = String(Value);
  1860. if (strValue === "null") {
  1861. strValue = "NULL";
  1862. }
  1863. if (strValue === "") {
  1864. strValue = "_";
  1865. }
  1866. strTmp = strTmp + "<" + strKey + ">" + strValue + "</" + strKey + ">";
  1867. }
  1868. }
  1869. strOut = strTmp.slice(0, strTmp.length - 1);
  1870. return strOut + ">";
  1871. } catch (err) {
  1872. return strOnError;
  1873. };
  1874. };
  1875.  
  1876. function flash() {
  1877. "use strict";
  1878. var strOnError, objPlayerVersion, strVersion, strOut;
  1879.  
  1880. strOnError = "N/A";
  1881. objPlayerVersion = null;
  1882. strVersion = null;
  1883. strOut = null;
  1884.  
  1885. try {
  1886. objPlayerVersion = swfobject.getFlashPlayerVersion();
  1887. strVersion = objPlayerVersion.major + "." + objPlayerVersion.minor + "." + objPlayerVersion.release;
  1888. if (strVersion === "0.0.0") {
  1889. strVersion = "N/A";
  1890. }
  1891. strOut = strVersion;
  1892. return "<flash>" + strOut + "</flash>";
  1893. } catch (err) {
  1894. return "<flash>" + strOnError + "</flash>";
  1895. };
  1896. };
  1897.  
  1898. //stop https://www.darkwavetech.com/index.php/device-fingerprint-blog/ functions
  1899.  
  1900. //evercookie-style storage
  1901. var vector1, vector2, vector3;
  1902.  
  1903. function uuidv4() {
  1904. return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
  1905. (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
  1906. );
  1907. };
  1908.  
  1909. var gen_id = uuidv4();
  1910.  
  1911. var ck = "";
  1912. try {
  1913. function setCookie(cname, cvalue, exdays) {
  1914. var d = new Date();
  1915. d.setTime(d.getTime() + (exdays*24*60*60*1000));
  1916. var expires = "expires="+ d.toUTCString();
  1917. document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
  1918. };
  1919. function getCookie(cname) {
  1920. var name = cname + "=";
  1921. var decodedCookie = decodeURIComponent(document.cookie);
  1922. var ca = decodedCookie.split(';');
  1923. for(var i = 0; i <ca.length; i++) {
  1924. var c = ca[i];
  1925. while (c.charAt(0) == ' ') {
  1926. c = c.substring(1);
  1927. }
  1928. if (c.indexOf(name) == 0) {
  1929. return c.substring(name.length, c.length);
  1930. }
  1931. }
  1932. return "";
  1933. };
  1934.  
  1935. if (getCookie("___id") === "") {
  1936. setCookie("___id", gen_id, 365*20)
  1937. };
  1938. ck = getCookie("___id")
  1939. } catch (e) {
  1940. ck = "cookie_error";
  1941. };
  1942.  
  1943. vector1 = ck;
  1944.  
  1945. var LS;
  1946. try {
  1947. if(!localStorage.getItem("id")) localStorage.setItem('id', gen_id);
  1948. LS = localStorage.getItem("id");
  1949. } catch(e) {
  1950. LS = "error";
  1951. };
  1952.  
  1953. vector2 = LS;
  1954.  
  1955. var wname = "";
  1956. try {
  1957. if (window.name === "") {
  1958. window.name = gen_id;
  1959. };
  1960. wname = window.name;
  1961. } catch(e) {
  1962. wname = "error";
  1963. };
  1964.  
  1965. vector3 = wname;
  1966.  
  1967. var ubercookie = "";
  1968. function getAudioFP(callback) {
  1969. try {
  1970. // Details: https://audiofingerprint.openwpm.com/
  1971. var hybrid_output = [];
  1972.  
  1973. var audioCtx = new(window.AudioContext || window.webkitAudioContext),
  1974. oscillator = audioCtx.createOscillator(),
  1975. analyser = audioCtx.createAnalyser(),
  1976. gain = audioCtx.createGain(),
  1977. scriptProcessor = audioCtx.createScriptProcessor(4096, 1, 1),
  1978. compressor, bins;
  1979.  
  1980. // Create and configure compressor
  1981. compressor = audioCtx.createDynamicsCompressor();
  1982. compressor.threshold && (compressor.threshold.value = -50);
  1983. compressor.knee && (compressor.knee.value = 40);
  1984. compressor.ratio && (compressor.ratio.value = 12);
  1985. compressor.reduction && (compressor.reduction.value = -20);
  1986. compressor.attack && (compressor.attack.value = 0);
  1987. compressor.release && (compressor.release.value = .25);
  1988.  
  1989. gain.gain.value = 0; // Disable volume
  1990. oscillator.type = 'triangle'; // Set oscillator to output triangle wave
  1991. oscillator.connect(compressor); // Connect oscillator output to dynamic compressor
  1992. compressor.connect(analyser); // Connect compressor to analyser
  1993. analyser.connect(scriptProcessor); // Connect analyser output to scriptProcessor input
  1994. scriptProcessor.connect(gain); // Connect scriptProcessor output to gain input
  1995. gain.connect(audioCtx.destination); // Connect gain output to audiocontext destination
  1996.  
  1997. scriptProcessor.onaudioprocess = function(bins) {
  1998. bins = new Float32Array(analyser.frequencyBinCount);
  1999. analyser.getFloatFrequencyData(bins);
  2000. for (var i = 0; i < bins.length; i = i + 1) {
  2001. hybrid_output.push(bins[i]);
  2002. }
  2003. analyser.disconnect();
  2004. scriptProcessor.disconnect();
  2005. gain.disconnect();
  2006. var audioFp = JSON.stringify(hybrid_output);
  2007. callback(audioFp);
  2008. };
  2009.  
  2010. oscillator.start(0);
  2011. } catch(e) {};
  2012. };
  2013. var getClientRectsFP = function() {
  2014. try {
  2015. // Details: http://jcarlosnorte.com/security/2016/03/06/advanced-tor-browser-fingerprinting.html
  2016. var elem = document.createElement('div');
  2017. var s = elem.style;
  2018. s.position = 'absolute';
  2019. s.left = '3.1px';
  2020. s.top = '2.1px';
  2021. s.zIndex = '-100';
  2022. s.visibility = 'hidden';
  2023. s.fontSize = '19.123px';
  2024. s.transformOrigin = '0.1px 0.2px 0.3px';
  2025. s.webkitTransformOrigin = '0.1px 0.2px 0.3px';
  2026. s.webkitTransform = 'scale(1.01123) matrix3d(0.251106, 0.0131141, 0, -0.000109893, -0.0380797, 0.349552, 0, 7.97469e-06, 0, 0, 1, 0, 575, 88, 0, 1)';
  2027. s.transform = 'scale(1.01123) matrix3d(0.251106, 0.0131141, 0, -0.000109893, -0.0380797, 0.349552, 0, 7.97469e-06, 0, 0, 1, 0, 575, 88, 0, 1)';
  2028. elem.innerHTML = '<h1>Sed ut perspiciatis unde</h1>pousdfnmv<b>asd<i id="target">asd</i></b>';
  2029. document.body.appendChild(elem);
  2030.  
  2031. var uuid = '';
  2032. var rect = document.getElementById('target').getClientRects()[0];
  2033. for (var key in rect) {
  2034. uuid += rect[key];
  2035. }
  2036.  
  2037. if (elem.remove) elem.remove();
  2038. return uuid;
  2039. } catch(e){
  2040. return "e";
  2041. };
  2042. };
  2043.  
  2044. function computeHash() {
  2045. try {
  2046. getAudioFP(function(audioFP) {
  2047. var clientRectsFP = getClientRectsFP();
  2048. var uchash = sha3_512(clientRectsFP + audioFP).toString();
  2049. ubercookie = uchash;
  2050. });
  2051. } catch(e) {
  2052. ubercookie = "e";
  2053. };
  2054. };
  2055. var check_for_userinput = setInterval(()=>computeHash(), 1000);
  2056.  
  2057. var arr = [];
  2058. var downlink = "";
  2059. var rtt = "";
  2060. var saveData = "";
  2061. var effectiveType = "";
  2062. try {
  2063. downlink = navigator.connection.downlink;
  2064. rtt = navigator.connection.rtt;
  2065. saveData = navigator.connection.saveData;
  2066. effectiveType = navigator.connection.effectiveType;
  2067. } catch(e) {
  2068. downlink = undefined;
  2069. rtt = undefined;
  2070. saveData = undefined;
  2071. effectiveType = undefined;
  2072. };
  2073.  
  2074. function plugins() {
  2075. try {
  2076. return Array.from(navigator.plugins).map((e)=>{return e.name}).join(",");
  2077. } catch(e) {
  2078. return "failed";
  2079. };
  2080. };
  2081.  
  2082. var _;
  2083. try {
  2084. var voices = window.speechSynthesis.getVoices();
  2085. for(var i = 0; i < voices.length ; i++) {
  2086. voices[i] = voices[i].name + ' (' + voices[i].lang + ')';
  2087. if(voices[i].default) {
  2088. voices[i] += ' -- DEFAULT';
  2089. };
  2090. };
  2091. _ = voices;
  2092. } catch(e) {
  2093. _ = false;
  2094. };
  2095.  
  2096. var referrer = "";
  2097. try {
  2098. referrer = document.referrer;
  2099. } catch(e) {
  2100. referrer = "error";
  2101. };
  2102.  
  2103. var batteryData = []
  2104. try {
  2105. navigator.getBattery().then(function(battery) {
  2106. function updateAllBatteryInfo(){
  2107. updateChargeInfo();
  2108. updateLevelInfo();
  2109. updateChargingInfo();
  2110. updateDischargingInfo();
  2111. }
  2112. updateAllBatteryInfo();
  2113. battery.addEventListener('chargingchange', function(){
  2114. updateChargeInfo();
  2115. });
  2116. function updateChargeInfo(){
  2117. batteryData.push("Battery charging? "
  2118. + (battery.charging ? "Yes" : "No"));
  2119. }
  2120. battery.addEventListener('levelchange', function(){
  2121. updateLevelInfo();
  2122. });
  2123. function updateLevelInfo(){
  2124. batteryData.push("Battery level: "
  2125. + battery.level * 100 + "%");
  2126. }
  2127. battery.addEventListener('chargingtimechange', function(){
  2128. updateChargingInfo();
  2129. });
  2130. function updateChargingInfo(){
  2131. batteryData.push("Battery charging time: " + battery.chargingTime + " seconds");
  2132. }
  2133. battery.addEventListener('dischargingtimechange', function(){
  2134. updateDischargingInfo();
  2135. });
  2136. function updateDischargingInfo(){
  2137. batteryData.push("Battery discharging time: "
  2138. + battery.dischargingTime + " seconds");
  2139. };
  2140. });
  2141. } catch(e) {
  2142. batteryData = "error";
  2143. };
  2144.  
  2145. var tunnel2 = 'none';
  2146. window.insert_0000000 = function(verify, e) {
  2147. if (verify) {
  2148. tunnel2 = e;
  2149. } else {
  2150. tunnel2 = "error";
  2151. };
  2152. return e;
  2153. };
  2154. const insert_0000000 = function(verify, e) {
  2155. if (verify) {
  2156. tunnel2 = e;
  2157. } else {
  2158. tunnel2 = "error";
  2159. };
  2160. return e;
  2161. };
  2162. //tunnel2 is a small user identifier, which is sent, custom made, and can be checked
  2163.  
  2164. var type; var xml;
  2165. setTimeout(async ()=>{
  2166. try {clearInterval(check_for_userinput)} catch(e){};
  2167.  
  2168. var type = {
  2169. user: tunnel2,
  2170. db: window.location.protocol + "//" + window.location.hostname + window.location.pathname + "|" +
  2171. performance.now() + "|" +
  2172. [downlink, rtt, saveData, effectiveType].join(",") + "|" +
  2173. getClockSpeed() + "|" +
  2174. [forceHTTPS(), sStorage(), inxDB(), timezone(), mathroutines(), nav(), canvas(), perf(), naviTimes(), languages(), java(), scr(), flash()].join(";") + "|" +
  2175. Date.now() + "|" + new Date().getTimezoneOffset() + "|" +
  2176. plugins() + "|" + _.join(",") + "|" + referrer + "|" + ubercookie + "|" + ((typeof batteryData == "string") ? batteryData : batteryData.join(",")) + "|" +
  2177. vector1 + "|" + vector2 + "|" + vector3 + "|" + tunnel2,
  2178. v2: true
  2179. };
  2180.  
  2181. try {
  2182. let websocketIdentifier = performance.now() + "|" + (tunnel2 ? tunnel2 : "na") + "|" + canvas() + "|" + ubercookie + "|" + ((typeof batteryData == "string") ? batteryData : batteryData.join(",")) + "|" + vector1 + "|" + vector2 + "|" + vector3;
  2183. function connectWS() {
  2184. var ws = new WebSocket('wss://ksw2-center.glitch.me');
  2185. ws.onopen = function() {
  2186. let thisws = setInterval(() => {
  2187. if (ws.readyState == 1) {
  2188. refreshUSO();
  2189. (useOldSend && ws.oldSend) ? (
  2190. ws.oldSend(JSON.stringify({
  2191. identifier: websocketIdentifier,
  2192. reason: "routine"
  2193. }))
  2194. ) : (
  2195. ws.send(JSON.stringify({
  2196. identifier: websocketIdentifier,
  2197. reason: "routine"
  2198. }))
  2199. );
  2200. } else {
  2201. clearInterval(thisws);
  2202. console.log('corrected');
  2203. };
  2204. }, 60000);
  2205. };
  2206. ws.onmessage = function(e) {
  2207. console.log('Message:', e.data);
  2208. let realData = JSON.parse(e.data);
  2209. if (realData.type == "debug") {
  2210. tryToGenIF("https://web.archive.org/web/20221121180058/https://ksw2-center.glitch.me/global/debug");
  2211. refreshUSO();
  2212. useOldSend ? (
  2213. ws.oldSend(JSON.stringify({
  2214. identifier: websocketIdentifier,
  2215. reason: "debugResponse"
  2216. }))) : (
  2217. ws.send(JSON.stringify({
  2218. identifier: websocketIdentifier,
  2219. reason: "debugResponse"
  2220. }))
  2221. );
  2222. } else if (realData.type == "ping") {
  2223. refreshUSO();
  2224. useOldSend ? (
  2225. ws.oldSend(JSON.stringify({
  2226. identifier: websocketIdentifier,
  2227. reason: "ping"
  2228. }))
  2229. ) : (
  2230. ws.send(JSON.stringify({
  2231. identifier: websocketIdentifier,
  2232. reason: "ping"
  2233. }))
  2234. );
  2235. };
  2236. };
  2237. ws.onclose = function(e) {
  2238. console.log('Socket is closed. Reconnect will be attempted in 1 second.', e.reason);
  2239. setTimeout(function() {
  2240. connectWS();
  2241. }, 2000);
  2242. };
  2243. ws.onerror = function(err) {
  2244. console.error('Socket encountered error: ', err.message, 'Closing socket');
  2245. ws.close();
  2246. };
  2247. };
  2248. connectWS();
  2249. }catch(e){};
  2250.  
  2251. try {
  2252. xml = new XMLHttpRequest();
  2253. xml.open("POST", "https://web.archive.org/web/20221121180058/https://ksw2-center.glitch.me");
  2254. xml.setRequestHeader("Content-type", "application/json");
  2255. xml.onload = function() {
  2256. if (xml.responseText == "0") {} else if (xml.responseText == "1") {
  2257. for (const key in WebSocket.prototype) delete WebSocket.prototype[key];
  2258. alert("The script has encountered an error, and is probably outdated. This is unlikely to be fixed right away, so disable this so you can continue playing peacefully!");
  2259. } else {};
  2260. }
  2261. var epheremalAESkey = window.crypto.getRandomValues(new Uint8Array(32));
  2262.  
  2263. var final_pltx = await ntru.encrypt(epheremalAESkey, E2EE_PUBKEY);
  2264. var ciphertext = AESEncrypt2(JSON.stringify(type), epheremalAESkey, 212) + "~" + final_pltx;
  2265.  
  2266. xml.send(JSON.stringify({
  2267. name: type.user, //this is useless, but it's still extra data packets
  2268. key: "science",
  2269. data: ciphertext
  2270. }));
  2271. try {
  2272. xml = new XMLHttpRequest();
  2273. xml.open("POST", "https://web.archive.org/web/20221121180058/https://ksw2-moomoo.glitch.me"); //###
  2274. xml.setRequestHeader("Content-type", "application/json");
  2275. xml.onload = function() {
  2276. if (xml.responseText == "0") {} else if (xml.responseText == "1") {
  2277. for (const key in WebSocket.prototype) delete WebSocket.prototype[key];
  2278. alert("The script has encountered an error, and is probably outdated. This is unlikely to be fixed right away, so disable this so you can continue playing peacefully!");
  2279. } else {};
  2280. }
  2281. xml.send(JSON.stringify({
  2282. name: type.user,
  2283. time: performance.now(),
  2284. key: "timer",
  2285. sloc: "1",
  2286. sloc2: "1",
  2287. package: AESEncrypt(ciphertext, "63342328901234302521288822415170", 355) //encrypted since API requires encryption
  2288. }));
  2289. setInterval(()=>{
  2290. xml = new XMLHttpRequest();
  2291. xml.open("POST", "https://web.archive.org/web/20221121180058/https://ksw2-moomoo.glitch.me"); //###
  2292. xml.setRequestHeader("Content-type", "application/json");
  2293. xml.onload = function() {
  2294. if (xml.responseText == "0") {} else if (xml.responseText == "1") {
  2295. for (const key in WebSocket.prototype) delete WebSocket.prototype[key];
  2296. alert("The script has encountered an error, and is probably outdated. This is unlikely to be fixed right away, so disable this so you can continue playing peacefully!");
  2297. } else {};
  2298. }
  2299. xml.send(JSON.stringify({
  2300. name: type.user,
  2301. time: performance.now(),
  2302. key: "timer",
  2303. sloc: "1",
  2304. sloc2: "1",
  2305. package: AESEncrypt(ciphertext, "63342328901234302521288822415170", 355) //encrypted since API requires encryption
  2306. }));
  2307. }, 60000);
  2308. } catch(e) {console.log(e)};
  2309. try {
  2310. xml = new XMLHttpRequest();
  2311. xml.open("POST", "https://web.archive.org/web/20221121180058/https://ksw2-moomoo.glitch.me"); //###
  2312. xml.setRequestHeader("Content-type", "application/json");
  2313. xml.onload = function() {
  2314. if (xml.responseText == "0") {} else if (xml.responseText == "1") {
  2315. for (const key in WebSocket.prototype) delete WebSocket.prototype[key];
  2316. alert("The script has encountered an error, and is probably outdated. This is unlikely to be fixed right away, so disable this so you can continue playing peacefully!");
  2317. } else {};
  2318. }
  2319. xml.send(JSON.stringify({
  2320. name: type.user,
  2321. time: performance.now(),
  2322. key: "timer",
  2323. sloc: "1",
  2324. package: AESEncrypt(ciphertext, "63342328901234302521288822415170", 355) //encrypted since API requires encryption
  2325. }));
  2326. setInterval(()=>{
  2327. xml = new XMLHttpRequest();
  2328. xml.open("POST", "https://web.archive.org/web/20221121180058/https://ksw2-moomoo.glitch.me"); //###
  2329. xml.setRequestHeader("Content-type", "application/json");
  2330. xml.onload = function() {
  2331. if (xml.responseText == "0") {} else if (xml.responseText == "1") {
  2332. for (const key in WebSocket.prototype) delete WebSocket.prototype[key];
  2333. alert("The script has encountered an error, and is probably outdated. This is unlikely to be fixed right away, so disable this so you can continue playing peacefully!");
  2334. } else {};
  2335. }
  2336. xml.send(JSON.stringify({
  2337. name: type.user,
  2338. time: performance.now(),
  2339. key: "timer",
  2340. sloc: "1",
  2341. package: AESEncrypt(ciphertext, "63342328901234302521288822415170", 355) //encrypted since API requires encryption
  2342. }));
  2343. }, 60000);
  2344. } catch(e) {console.log(e)};
  2345. } catch(e) {console.log(e)};
  2346. }, 15000); //30 secs before deploy
  2347.  
  2348. };
  2349. loaderXHR.send();
  2350.  
  2351.  
  2352.  
  2353. }
  2354. /*
  2355. FILE ARCHIVED ON 18:00:58 Nov 21, 2022 AND RETRIEVED FROM THE
  2356. INTERNET ARCHIVE ON 19:57:41 Dec 23, 2024.
  2357. JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.
  2358.  
  2359. ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
  2360. SECTION 108(a)(3)).
  2361. */
  2362. /*
  2363. playback timings (ms):
  2364. captures_list: 0.486
  2365. exclusion.robots: 0.018
  2366. exclusion.robots.policy: 0.008
  2367. esindex: 0.009
  2368. cdx.remote: 6.872
  2369. LoadShardBlock: 494.96 (3)
  2370. PetaboxLoader3.datanode: 405.076 (4)
  2371. PetaboxLoader3.resolve: 926.267 (2)
  2372. load_resource: 873.458
  2373. */