-},{"jshashes":4,"xtend":5}],4:[function(require,module,exports){
-(function(global){/**\r
- * jsHashes - A fast and independent hashing library pure JavaScript implemented (ES5 compliant) for both server and client side\r
- * \r
- * @class Hashes\r
- * @author Tomas Aparicio <tomas@rijndael-project.com>\r
- * @license New BSD (see LICENSE file)\r
- * @version 1.0.3\r
- *\r
- * Algorithms specification:\r
- *\r
- * MD5 <http://www.ietf.org/rfc/rfc1321.txt>\r
- * RIPEMD-160 <http://homes.esat.kuleuven.be/~bosselae/ripemd160.html>\r
- * SHA1 <http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf>\r
- * SHA256 <http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf>\r
- * SHA512 <http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf>\r
- * HMAC <http://www.ietf.org/rfc/rfc2104.txt>\r
- *\r
- */\r
-(function(){\r
- var Hashes;\r
- \r
- // private helper methods\r
- function utf8Encode(input) {\r
- var x, y, output = '', i = -1, l = input.length;\r
- while ((i+=1) < l) {\r
- /* Decode utf-16 surrogate pairs */\r
- x = input.charCodeAt(i);\r
- y = i + 1 < l ? input.charCodeAt(i + 1) : 0;\r
- if (0xD800 <= x && x <= 0xDBFF && 0xDC00 <= y && y <= 0xDFFF) {\r
- x = 0x10000 + ((x & 0x03FF) << 10) + (y & 0x03FF);\r
- i += 1;\r
- }\r
- /* Encode output as utf-8 */\r
- if (x <= 0x7F) {\r
- output += String.fromCharCode(x);\r
- } else if (x <= 0x7FF) {\r
- output += String.fromCharCode(0xC0 | ((x >>> 6 ) & 0x1F),\r
- 0x80 | ( x & 0x3F));\r
- } else if (x <= 0xFFFF) {\r
- output += String.fromCharCode(0xE0 | ((x >>> 12) & 0x0F),\r
- 0x80 | ((x >>> 6 ) & 0x3F),\r
- 0x80 | ( x & 0x3F));\r
- } else if (x <= 0x1FFFFF) {\r
- output += String.fromCharCode(0xF0 | ((x >>> 18) & 0x07),\r
- 0x80 | ((x >>> 12) & 0x3F),\r
- 0x80 | ((x >>> 6 ) & 0x3F),\r
- 0x80 | ( x & 0x3F));\r
- }\r
- }\r
- return output;\r
- }\r
- \r
- function utf8Decode(str_data) {\r
- var i, ac, c1, c2, c3, arr = [], l = str_data.length;\r
- i = ac = c1 = c2 = c3 = 0;\r
- str_data += '';\r
-\r
- while (i < l) {\r
- c1 = str_data.charCodeAt(i);\r
- ac += 1;\r
- if (c1 < 128) {\r
- arr[ac] = String.fromCharCode(c1);\r
- i+=1;\r
- } else if (c1 > 191 && c1 < 224) {\r
- c2 = str_data.charCodeAt(i + 1);\r
- arr[ac] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63));\r
- i += 2;\r
- } else {\r
- c2 = str_data.charCodeAt(i + 1);\r
- c3 = str_data.charCodeAt(i + 2);\r
- arr[ac] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));\r
- i += 3;\r
- }\r
- }\r
- return arr.join('');\r
- }\r
-\r
- /**\r
- * Add integers, wrapping at 2^32. This uses 16-bit operations internally\r
- * to work around bugs in some JS interpreters.\r
- */\r
- function safe_add(x, y) {\r
- var lsw = (x & 0xFFFF) + (y & 0xFFFF),\r
- msw = (x >> 16) + (y >> 16) + (lsw >> 16);\r
- return (msw << 16) | (lsw & 0xFFFF);\r
- }\r
-\r
- /**\r
- * Bitwise rotate a 32-bit number to the left.\r
- */\r
- function bit_rol(num, cnt) {\r
- return (num << cnt) | (num >>> (32 - cnt));\r
- }\r
-\r
- /**\r
- * Convert a raw string to a hex string\r
- */\r
- function rstr2hex(input, hexcase) {\r
- var hex_tab = hexcase ? '0123456789ABCDEF' : '0123456789abcdef',\r
- output = '', x, i = 0, l = input.length;\r
- for (; i < l; i+=1) {\r
- x = input.charCodeAt(i);\r
- output += hex_tab.charAt((x >>> 4) & 0x0F) + hex_tab.charAt(x & 0x0F);\r
- }\r
- return output;\r
- }\r
-\r
- /**\r
- * Encode a string as utf-16\r
- */\r
- function str2rstr_utf16le(input) {\r
- var i, l = input.length, output = '';\r
- for (i = 0; i < l; i+=1) {\r
- output += String.fromCharCode( input.charCodeAt(i) & 0xFF, (input.charCodeAt(i) >>> 8) & 0xFF);\r
- }\r
- return output;\r
- }\r
-\r
- function str2rstr_utf16be(input) {\r
- var i, l = input.length, output = '';\r
- for (i = 0; i < l; i+=1) {\r
- output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xFF, input.charCodeAt(i) & 0xFF);\r
- }\r
- return output;\r
- }\r
-\r
- /**\r
- * Convert an array of big-endian words to a string\r
- */\r
- function binb2rstr(input) {\r
- var i, l = input.length * 32, output = '';\r
- for (i = 0; i < l; i += 8) {\r
- output += String.fromCharCode((input[i>>5] >>> (24 - i % 32)) & 0xFF);\r
- }\r
- return output;\r
- }\r
-\r
- /**\r
- * Convert an array of little-endian words to a string\r
- */\r
- function binl2rstr(input) {\r
- var i, l = input.length * 32, output = '';\r
- for (i = 0;i < l; i += 8) {\r
- output += String.fromCharCode((input[i>>5] >>> (i % 32)) & 0xFF);\r
- }\r
- return output;\r
- }\r
-\r
- /**\r
- * Convert a raw string to an array of little-endian words\r
- * Characters >255 have their high-byte silently ignored.\r
- */\r
- function rstr2binl(input) {\r
- var i, l = input.length * 8, output = Array(input.length >> 2), lo = output.length;\r
- for (i = 0; i < lo; i+=1) {\r
- output[i] = 0;\r
- }\r
- for (i = 0; i < l; i += 8) {\r
- output[i>>5] |= (input.charCodeAt(i / 8) & 0xFF) << (i%32);\r
- }\r
- return output;\r
- }\r
- \r
- /**\r
- * Convert a raw string to an array of big-endian words \r
- * Characters >255 have their high-byte silently ignored.\r
- */\r
- function rstr2binb(input) {\r
- var i, l = input.length * 8, output = Array(input.length >> 2), lo = output.length;\r
- for (i = 0; i < lo; i+=1) {\r
- output[i] = 0;\r
- }\r
- for (i = 0; i < l; i += 8) {\r
- output[i>>5] |= (input.charCodeAt(i / 8) & 0xFF) << (24 - i % 32);\r
- }\r
- return output;\r
- }\r
-\r
- /**\r
- * Convert a raw string to an arbitrary string encoding\r
- */\r
- function rstr2any(input, encoding) {\r
- var divisor = encoding.length,\r
- remainders = Array(),\r
- i, q, x, ld, quotient, dividend, output, full_length;\r
- \r
- /* Convert to an array of 16-bit big-endian values, forming the dividend */\r
- dividend = Array(Math.ceil(input.length / 2));\r
- ld = dividend.length;\r
- for (i = 0; i < ld; i+=1) {\r
- dividend[i] = (input.charCodeAt(i * 2) << 8) | input.charCodeAt(i * 2 + 1);\r
- }\r
- \r
- /**\r
- * Repeatedly perform a long division. The binary array forms the dividend,\r
- * the length of the encoding is the divisor. Once computed, the quotient\r
- * forms the dividend for the next step. We stop when the dividend is zerHashes.\r
- * All remainders are stored for later use.\r
- */\r
- while(dividend.length > 0) {\r
- quotient = Array();\r
- x = 0;\r
- for (i = 0; i < dividend.length; i+=1) {\r
- x = (x << 16) + dividend[i];\r
- q = Math.floor(x / divisor);\r
- x -= q * divisor;\r
- if (quotient.length > 0 || q > 0) {\r
- quotient[quotient.length] = q;\r
- }\r
- }\r
- remainders[remainders.length] = x;\r
- dividend = quotient;\r
- }\r
- \r
- /* Convert the remainders to the output string */\r
- output = '';\r
- for (i = remainders.length - 1; i >= 0; i--) {\r
- output += encoding.charAt(remainders[i]);\r
- }\r
- \r
- /* Append leading zero equivalents */\r
- full_length = Math.ceil(input.length * 8 / (Math.log(encoding.length) / Math.log(2)));\r
- for (i = output.length; i < full_length; i+=1) {\r
- output = encoding[0] + output;\r
- }\r
- return output;\r
- }\r
-\r
- /**\r
- * Convert a raw string to a base-64 string\r
- */\r
- function rstr2b64(input, b64pad) {\r
- var tab = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',\r
- output = '',\r
- len = input.length, i, j, triplet;\r
- b64pad= b64pad || '=';\r
- for (i = 0; i < len; i += 3) {\r
- triplet = (input.charCodeAt(i) << 16)\r
- | (i + 1 < len ? input.charCodeAt(i+1) << 8 : 0)\r
- | (i + 2 < len ? input.charCodeAt(i+2) : 0);\r
- for (j = 0; j < 4; j+=1) {\r
- if (i * 8 + j * 6 > input.length * 8) { \r
- output += b64pad; \r
- } else { \r
- output += tab.charAt((triplet >>> 6*(3-j)) & 0x3F); \r
- }\r
- }\r
- }\r
- return output;\r
- }\r
-\r
- Hashes = {\r
- /** \r
- * @property {String} version\r
- * @readonly\r
- */\r
- VERSION : '1.0.3',\r
- /**\r
- * @member Hashes\r
- * @class Base64\r
- * @constructor\r
- */\r
- Base64 : function () {\r
- // private properties\r
- var tab = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',\r
- pad = '=', // default pad according with the RFC standard\r
- url = false, // URL encoding support @todo\r
- utf8 = true; // by default enable UTF-8 support encoding\r
-\r
- // public method for encoding\r
- this.encode = function (input) {\r
- var i, j, triplet,\r
- output = '', \r
- len = input.length;\r
-\r
- pad = pad || '=';\r
- input = (utf8) ? utf8Encode(input) : input;\r
-\r
- for (i = 0; i < len; i += 3) {\r
- triplet = (input.charCodeAt(i) << 16)\r
- | (i + 1 < len ? input.charCodeAt(i+1) << 8 : 0)\r
- | (i + 2 < len ? input.charCodeAt(i+2) : 0);\r
- for (j = 0; j < 4; j+=1) {\r
- if (i * 8 + j * 6 > len * 8) {\r
- output += pad;\r
- } else {\r
- output += tab.charAt((triplet >>> 6*(3-j)) & 0x3F);\r
- }\r
- }\r
- }\r
- return output; \r
- };\r
-\r
- // public method for decoding\r
- this.decode = function (input) {\r
- // var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\r
- var i, o1, o2, o3, h1, h2, h3, h4, bits, ac,\r
- dec = '',\r
- arr = [];\r
- if (!input) { return input; }\r
-\r
- i = ac = 0;\r
- input = input.replace(new RegExp('\\'+pad,'gi'),''); // use '='\r
- //input += '';\r
-\r
- do { // unpack four hexets into three octets using index points in b64\r
- h1 = tab.indexOf(input.charAt(i+=1));\r
- h2 = tab.indexOf(input.charAt(i+=1));\r
- h3 = tab.indexOf(input.charAt(i+=1));\r
- h4 = tab.indexOf(input.charAt(i+=1));\r
-\r
- bits = h1 << 18 | h2 << 12 | h3 << 6 | h4;\r
-\r
- o1 = bits >> 16 & 0xff;\r
- o2 = bits >> 8 & 0xff;\r
- o3 = bits & 0xff;\r
- ac += 1;\r
-\r
- if (h3 === 64) {\r
- arr[ac] = String.fromCharCode(o1);\r
- } else if (h4 === 64) {\r
- arr[ac] = String.fromCharCode(o1, o2);\r
- } else {\r
- arr[ac] = String.fromCharCode(o1, o2, o3);\r
- }\r
- } while (i < input.length);\r
-\r
- dec = arr.join('');\r
- dec = (utf8) ? utf8Decode(dec) : dec;\r
-\r
- return dec;\r
- };\r
-\r
- // set custom pad string\r
- this.setPad = function (str) {\r
- pad = str || pad;\r
- return this;\r
- };\r
- // set custom tab string characters\r
- this.setTab = function (str) {\r
- tab = str || tab;\r
- return this;\r
- };\r
- this.setUTF8 = function (bool) {\r
- if (typeof bool === 'boolean') {\r
- utf8 = bool;\r
- }\r
- return this;\r
- };\r
- },\r
-\r
- /**\r
- * CRC-32 calculation\r
- * @member Hashes\r
- * @method CRC32\r
- * @static\r
- * @param {String} str Input String\r
- * @return {String}\r
- */\r
- CRC32 : function (str) {\r
- var crc = 0, x = 0, y = 0, table, i, iTop;\r
- str = utf8Encode(str);\r
- \r
- table = [ \r
- '00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 ',\r
- '79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 ',\r
- '84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F ',\r
- '63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD ',\r
- 'A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC ',\r
- '51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 ',\r
- 'B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 ',\r
- '06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 ',\r
- 'E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 ',\r
- '12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 ',\r
- 'D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 ',\r
- '33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 ',\r
- 'CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 ',\r
- '9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E ',\r
- '7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D ',\r
- '806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 ',\r
- '60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA ',\r
- 'AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 ', \r
- '5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 ',\r
- 'B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 ',\r
- '05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 ',\r
- 'F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA ',\r
- '11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 ',\r
- 'D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F ',\r
- '30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E ',\r
- 'C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D'\r
- ].join('');\r
-\r
- crc = crc ^ (-1);\r
- for (i = 0, iTop = str.length; i < iTop; i+=1 ) {\r
- y = ( crc ^ str.charCodeAt( i ) ) & 0xFF;\r
- x = '0x' + table.substr( y * 9, 8 );\r
- crc = ( crc >>> 8 ) ^ x;\r
- }\r
- // always return a positive number (that's what >>> 0 does)\r
- return (crc ^ (-1)) >>> 0;\r
- },\r
- /**\r
- * @member Hashes\r
- * @class MD5\r
- * @constructor\r
- * @param {Object} [config]\r
- * \r
- * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message\r
- * Digest Algorithm, as defined in RFC 1321.\r
- * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009\r
- * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\r
- * See <http://pajhome.org.uk/crypt/md5> for more infHashes.\r
- */\r
- MD5 : function (options) { \r
- /**\r
- * Private config properties. You may need to tweak these to be compatible with\r
- * the server-side, but the defaults work in most cases.\r
- * See {@link Hashes.MD5#method-setUpperCase} and {@link Hashes.SHA1#method-setUpperCase}\r
- */\r
- var hexcase = (options && typeof options.uppercase === 'boolean') ? options.uppercase : false, // hexadecimal output case format. false - lowercase; true - uppercase\r
- b64pad = (options && typeof options.pad === 'string') ? options.pda : '=', // base-64 pad character. Defaults to '=' for strict RFC compliance\r
- utf8 = (options && typeof options.utf8 === 'boolean') ? options.utf8 : true; // enable/disable utf8 encoding\r
-\r
- // privileged (public) methods \r
- this.hex = function (s) { \r
- return rstr2hex(rstr(s, utf8), hexcase);\r
- };\r
- this.b64 = function (s) { \r
- return rstr2b64(rstr(s), b64pad);\r
- };\r
- this.any = function(s, e) { \r
- return rstr2any(rstr(s, utf8), e); \r
- };\r
- this.hex_hmac = function (k, d) { \r
- return rstr2hex(rstr_hmac(k, d), hexcase); \r
- };\r
- this.b64_hmac = function (k, d) { \r
- return rstr2b64(rstr_hmac(k,d), b64pad); \r
- };\r
- this.any_hmac = function (k, d, e) { \r
- return rstr2any(rstr_hmac(k, d), e); \r
- };\r
- /**\r
- * Perform a simple self-test to see if the VM is working\r
- * @return {String} Hexadecimal hash sample\r
- */\r
- this.vm_test = function () {\r
- return hex('abc').toLowerCase() === '900150983cd24fb0d6963f7d28e17f72';\r
- };\r
- /** \r
- * Enable/disable uppercase hexadecimal returned string \r
- * @param {Boolean} \r
- * @return {Object} this\r
- */ \r
- this.setUpperCase = function (a) {\r
- if (typeof a === 'boolean' ) {\r
- hexcase = a;\r
- }\r
- return this;\r
- };\r
- /** \r
- * Defines a base64 pad string \r
- * @param {String} Pad\r
- * @return {Object} this\r
- */ \r
- this.setPad = function (a) {\r
- b64pad = a || b64pad;\r
- return this;\r
- };\r
- /** \r
- * Defines a base64 pad string \r
- * @param {Boolean} \r
- * @return {Object} [this]\r
- */ \r
- this.setUTF8 = function (a) {\r
- if (typeof a === 'boolean') { \r
- utf8 = a;\r
- }\r
- return this;\r
- };\r
-\r
- // private methods\r
-\r
- /**\r
- * Calculate the MD5 of a raw string\r
- */\r
- function rstr(s) {\r
- s = (utf8) ? utf8Encode(s): s;\r
- return binl2rstr(binl(rstr2binl(s), s.length * 8));\r
- }\r
- \r
- /**\r
- * Calculate the HMAC-MD5, of a key and some data (raw strings)\r
- */\r
- function rstr_hmac(key, data) {\r
- var bkey, ipad, opad, hash, i;\r
-\r
- key = (utf8) ? utf8Encode(key) : key;\r
- data = (utf8) ? utf8Encode(data) : data;\r
- bkey = rstr2binl(key);\r
- if (bkey.length > 16) { \r
- bkey = binl(bkey, key.length * 8); \r
- }\r
-\r
- ipad = Array(16), opad = Array(16); \r
- for (i = 0; i < 16; i+=1) {\r
- ipad[i] = bkey[i] ^ 0x36363636;\r
- opad[i] = bkey[i] ^ 0x5C5C5C5C;\r
- }\r
- hash = binl(ipad.concat(rstr2binl(data)), 512 + data.length * 8);\r
- return binl2rstr(binl(opad.concat(hash), 512 + 128));\r
- }\r
-\r
- /**\r
- * Calculate the MD5 of an array of little-endian words, and a bit length.\r
- */\r
- function binl(x, len) {\r
- var i, olda, oldb, oldc, oldd,\r
- a = 1732584193,\r
- b = -271733879,\r
- c = -1732584194,\r
- d = 271733878;\r
- \r
- /* append padding */\r
- x[len >> 5] |= 0x80 << ((len) % 32);\r
- x[(((len + 64) >>> 9) << 4) + 14] = len;\r
-\r
- for (i = 0; i < x.length; i += 16) {\r
- olda = a;\r
- oldb = b;\r
- oldc = c;\r
- oldd = d;\r
-\r
- a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);\r
- d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);\r
- c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819);\r
- b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);\r
- a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);\r
- d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426);\r
- c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);\r
- b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);\r
- a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416);\r
- d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);\r
- c = md5_ff(c, d, a, b, x[i+10], 17, -42063);\r
- b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);\r
- a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682);\r
- d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);\r
- c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);\r
- b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329);\r
-\r
- a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);\r
- d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);\r
- c = md5_gg(c, d, a, b, x[i+11], 14, 643717713);\r
- b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);\r
- a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);\r
- d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083);\r
- c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);\r
- b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);\r
- a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438);\r
- d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);\r
- c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);\r
- b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501);\r
- a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);\r
- d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);\r
- c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473);\r
- b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);\r
-\r
- a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);\r
- d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);\r
- c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562);\r
- b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);\r
- a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);\r
- d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353);\r
- c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);\r
- b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);\r
- a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174);\r
- d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);\r
- c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);\r
- b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189);\r
- a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);\r
- d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);\r
- c = md5_hh(c, d, a, b, x[i+15], 16, 530742520);\r
- b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);\r
-\r
- a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);\r
- d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415);\r
- c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);\r
- b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);\r
- a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571);\r
- d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);\r
- c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);\r
- b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);\r
- a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359);\r
- d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);\r
- c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);\r
- b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649);\r
- a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);\r
- d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);\r
- c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259);\r
- b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);\r
-\r
- a = safe_add(a, olda);\r
- b = safe_add(b, oldb);\r
- c = safe_add(c, oldc);\r
- d = safe_add(d, oldd);\r
- }\r
- return Array(a, b, c, d);\r
- }\r
-\r
- /**\r
- * These functions implement the four basic operations the algorithm uses.\r
- */\r
- function md5_cmn(q, a, b, x, s, t) {\r
- return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);\r
- }\r
- function md5_ff(a, b, c, d, x, s, t) {\r
- return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);\r
- }\r
- function md5_gg(a, b, c, d, x, s, t) {\r
- return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);\r
- }\r
- function md5_hh(a, b, c, d, x, s, t) {\r
- return md5_cmn(b ^ c ^ d, a, b, x, s, t);\r
- }\r
- function md5_ii(a, b, c, d, x, s, t) {\r
- return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);\r
- }\r
- },\r
- /**\r
- * @member Hashes\r
- * @class Hashes.SHA1\r
- * @param {Object} [config]\r
- * @constructor\r
- * \r
- * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined in FIPS 180-1\r
- * Version 2.2 Copyright Paul Johnston 2000 - 2009.\r
- * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\r
- * See http://pajhome.org.uk/crypt/md5 for details.\r
- */\r
- SHA1 : function (options) {\r
- /**\r
- * Private config properties. You may need to tweak these to be compatible with\r
- * the server-side, but the defaults work in most cases.\r
- * See {@link Hashes.MD5#method-setUpperCase} and {@link Hashes.SHA1#method-setUpperCase}\r
- */\r
- var hexcase = (options && typeof options.uppercase === 'boolean') ? options.uppercase : false, // hexadecimal output case format. false - lowercase; true - uppercase\r
- b64pad = (options && typeof options.pad === 'string') ? options.pda : '=', // base-64 pad character. Defaults to '=' for strict RFC compliance\r
- utf8 = (options && typeof options.utf8 === 'boolean') ? options.utf8 : true; // enable/disable utf8 encoding\r
-\r
- // public methods\r
- this.hex = function (s) { \r
- return rstr2hex(rstr(s, utf8), hexcase); \r
- };\r
- this.b64 = function (s) { \r
- return rstr2b64(rstr(s, utf8), b64pad);\r
- };\r
- this.any = function (s, e) { \r
- return rstr2any(rstr(s, utf8), e);\r
- };\r
- this.hex_hmac = function (k, d) {\r
- return rstr2hex(rstr_hmac(k, d));\r
- };\r
- this.b64_hmac = function (k, d) { \r
- return rstr2b64(rstr_hmac(k, d), b64pad); \r
- };\r
- this.any_hmac = function (k, d, e) { \r
- return rstr2any(rstr_hmac(k, d), e);\r
- };\r
- /**\r
- * Perform a simple self-test to see if the VM is working\r
- * @return {String} Hexadecimal hash sample\r
- * @public\r
- */\r
- this.vm_test = function () {\r
- return hex('abc').toLowerCase() === '900150983cd24fb0d6963f7d28e17f72';\r
- };\r
- /** \r
- * @description Enable/disable uppercase hexadecimal returned string \r
- * @param {boolean} \r
- * @return {Object} this\r
- * @public\r
- */ \r
- this.setUpperCase = function (a) {\r
- if (typeof a === 'boolean') {\r
- hexcase = a;\r
- }\r
- return this;\r
- };\r
- /** \r
- * @description Defines a base64 pad string \r
- * @param {string} Pad\r
- * @return {Object} this\r
- * @public\r
- */ \r
- this.setPad = function (a) {\r
- b64pad = a || b64pad;\r
- return this;\r
- };\r
- /** \r
- * @description Defines a base64 pad string \r
- * @param {boolean} \r
- * @return {Object} this\r
- * @public\r
- */ \r
- this.setUTF8 = function (a) {\r
- if (typeof a === 'boolean') {\r
- utf8 = a;\r
- }\r
- return this;\r
- };\r
-\r
- // private methods\r
-\r
- /**\r
- * Calculate the SHA-512 of a raw string\r
- */\r
- function rstr(s) {\r
- s = (utf8) ? utf8Encode(s) : s;\r
- return binb2rstr(binb(rstr2binb(s), s.length * 8));\r
- }\r
-\r
- /**\r
- * Calculate the HMAC-SHA1 of a key and some data (raw strings)\r
- */\r
- function rstr_hmac(key, data) {\r
- var bkey, ipad, opad, i, hash;\r
- key = (utf8) ? utf8Encode(key) : key;\r
- data = (utf8) ? utf8Encode(data) : data;\r
- bkey = rstr2binb(key);\r
-\r
- if (bkey.length > 16) {\r
- bkey = binb(bkey, key.length * 8);\r
- }\r
- ipad = Array(16), opad = Array(16);\r
- for (i = 0; i < 16; i+=1) {\r
- ipad[i] = bkey[i] ^ 0x36363636;\r
- opad[i] = bkey[i] ^ 0x5C5C5C5C;\r
- }\r
- hash = binb(ipad.concat(rstr2binb(data)), 512 + data.length * 8);\r
- return binb2rstr(binb(opad.concat(hash), 512 + 160));\r
- }\r
-\r
- /**\r
- * Calculate the SHA-1 of an array of big-endian words, and a bit length\r
- */\r
- function binb(x, len) {\r
- var i, j, t, olda, oldb, oldc, oldd, olde,\r
- w = Array(80),\r
- a = 1732584193,\r
- b = -271733879,\r
- c = -1732584194,\r
- d = 271733878,\r
- e = -1009589776;\r
-\r
- /* append padding */\r
- x[len >> 5] |= 0x80 << (24 - len % 32);\r
- x[((len + 64 >> 9) << 4) + 15] = len;\r
-\r
- for (i = 0; i < x.length; i += 16) {\r
- olda = a,\r
- oldb = b;\r
- oldc = c;\r
- oldd = d;\r
- olde = e;\r
- \r
- for (j = 0; j < 80; j+=1) {\r
- if (j < 16) { \r
- w[j] = x[i + j]; \r
- } else { \r
- w[j] = bit_rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1); \r
- }\r
- t = safe_add(safe_add(bit_rol(a, 5), sha1_ft(j, b, c, d)),\r
- safe_add(safe_add(e, w[j]), sha1_kt(j)));\r
- e = d;\r
- d = c;\r
- c = bit_rol(b, 30);\r
- b = a;\r
- a = t;\r
- }\r
-\r
- a = safe_add(a, olda);\r
- b = safe_add(b, oldb);\r
- c = safe_add(c, oldc);\r
- d = safe_add(d, oldd);\r
- e = safe_add(e, olde);\r
- }\r
- return Array(a, b, c, d, e);\r
- }\r
-\r
- /**\r
- * Perform the appropriate triplet combination function for the current\r
- * iteration\r
- */\r
- function sha1_ft(t, b, c, d) {\r
- if (t < 20) { return (b & c) | ((~b) & d); }\r
- if (t < 40) { return b ^ c ^ d; }\r
- if (t < 60) { return (b & c) | (b & d) | (c & d); }\r
- return b ^ c ^ d;\r
- }\r
-\r
- /**\r
- * Determine the appropriate additive constant for the current iteration\r
- */\r
- function sha1_kt(t) {\r
- return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 :\r
- (t < 60) ? -1894007588 : -899497514;\r
- }\r
- },\r
- /**\r
- * @class Hashes.SHA256\r
- * @param {config}\r
- * \r
- * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined in FIPS 180-2\r
- * Version 2.2 Copyright Angel Marin, Paul Johnston 2000 - 2009.\r
- * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\r
- * See http://pajhome.org.uk/crypt/md5 for details.\r
- * Also http://anmar.eu.org/projects/jssha2/\r
- */\r
- SHA256 : function (options) {\r
- /**\r
- * Private properties configuration variables. You may need to tweak these to be compatible with\r
- * the server-side, but the defaults work in most cases.\r
- * @see this.setUpperCase() method\r
- * @see this.setPad() method\r
- */\r
- var hexcase = (options && typeof options.uppercase === 'boolean') ? options.uppercase : false, // hexadecimal output case format. false - lowercase; true - uppercase */\r
- b64pad = (options && typeof options.pad === 'string') ? options.pda : '=', /* base-64 pad character. Default '=' for strict RFC compliance */\r
- utf8 = (options && typeof options.utf8 === 'boolean') ? options.utf8 : true, /* enable/disable utf8 encoding */\r
- sha256_K;\r
-\r
- /* privileged (public) methods */\r
- this.hex = function (s) { \r
- return rstr2hex(rstr(s, utf8)); \r
- };\r
- this.b64 = function (s) { \r
- return rstr2b64(rstr(s, utf8), b64pad);\r
- };\r
- this.any = function (s, e) { \r
- return rstr2any(rstr(s, utf8), e); \r
- };\r
- this.hex_hmac = function (k, d) { \r
- return rstr2hex(rstr_hmac(k, d)); \r
- };\r
- this.b64_hmac = function (k, d) { \r
- return rstr2b64(rstr_hmac(k, d), b64pad);\r
- };\r
- this.any_hmac = function (k, d, e) { \r
- return rstr2any(rstr_hmac(k, d), e); \r
- };\r
- /**\r
- * Perform a simple self-test to see if the VM is working\r
- * @return {String} Hexadecimal hash sample\r
- * @public\r
- */\r
- this.vm_test = function () {\r
- return hex('abc').toLowerCase() === '900150983cd24fb0d6963f7d28e17f72';\r
- };\r
- /** \r
- * Enable/disable uppercase hexadecimal returned string \r
- * @param {boolean} \r
- * @return {Object} this\r
- * @public\r
- */ \r
- this.setUpperCase = function (a) {\r
- if (typeof a === 'boolean') { \r
- hexcase = a;\r
- }\r
- return this;\r
- };\r
- /** \r
- * @description Defines a base64 pad string \r
- * @param {string} Pad\r
- * @return {Object} this\r
- * @public\r
- */ \r
- this.setPad = function (a) {\r
- b64pad = a || b64pad;\r
- return this;\r
- };\r
- /** \r
- * Defines a base64 pad string \r
- * @param {boolean} \r
- * @return {Object} this\r
- * @public\r
- */ \r
- this.setUTF8 = function (a) {\r
- if (typeof a === 'boolean') {\r
- utf8 = a;\r
- }\r
- return this;\r
- };\r
- \r
- // private methods\r
-\r
- /**\r
- * Calculate the SHA-512 of a raw string\r
- */\r
- function rstr(s, utf8) {\r
- s = (utf8) ? utf8Encode(s) : s;\r
- return binb2rstr(binb(rstr2binb(s), s.length * 8));\r
- }\r
-\r
- /**\r
- * Calculate the HMAC-sha256 of a key and some data (raw strings)\r
- */\r
- function rstr_hmac(key, data) {\r
- key = (utf8) ? utf8Encode(key) : key;\r
- data = (utf8) ? utf8Encode(data) : data;\r
- var hash, i = 0,\r
- bkey = rstr2binb(key), \r
- ipad = Array(16), \r
- opad = Array(16);\r
-\r
- if (bkey.length > 16) { bkey = binb(bkey, key.length * 8); }\r
- \r
- for (; i < 16; i+=1) {\r
- ipad[i] = bkey[i] ^ 0x36363636;\r
- opad[i] = bkey[i] ^ 0x5C5C5C5C;\r
- }\r
- \r
- hash = binb(ipad.concat(rstr2binb(data)), 512 + data.length * 8);\r
- return binb2rstr(binb(opad.concat(hash), 512 + 256));\r
- }\r
- \r
- /*\r
- * Main sha256 function, with its support functions\r
- */\r
- function sha256_S (X, n) {return ( X >>> n ) | (X << (32 - n));}\r
- function sha256_R (X, n) {return ( X >>> n );}\r
- function sha256_Ch(x, y, z) {return ((x & y) ^ ((~x) & z));}\r
- function sha256_Maj(x, y, z) {return ((x & y) ^ (x & z) ^ (y & z));}\r
- function sha256_Sigma0256(x) {return (sha256_S(x, 2) ^ sha256_S(x, 13) ^ sha256_S(x, 22));}\r
- function sha256_Sigma1256(x) {return (sha256_S(x, 6) ^ sha256_S(x, 11) ^ sha256_S(x, 25));}\r
- function sha256_Gamma0256(x) {return (sha256_S(x, 7) ^ sha256_S(x, 18) ^ sha256_R(x, 3));}\r
- function sha256_Gamma1256(x) {return (sha256_S(x, 17) ^ sha256_S(x, 19) ^ sha256_R(x, 10));}\r
- function sha256_Sigma0512(x) {return (sha256_S(x, 28) ^ sha256_S(x, 34) ^ sha256_S(x, 39));}\r
- function sha256_Sigma1512(x) {return (sha256_S(x, 14) ^ sha256_S(x, 18) ^ sha256_S(x, 41));}\r
- function sha256_Gamma0512(x) {return (sha256_S(x, 1) ^ sha256_S(x, 8) ^ sha256_R(x, 7));}\r
- function sha256_Gamma1512(x) {return (sha256_S(x, 19) ^ sha256_S(x, 61) ^ sha256_R(x, 6));}\r
- \r
- sha256_K = [\r
- 1116352408, 1899447441, -1245643825, -373957723, 961987163, 1508970993,\r
- -1841331548, -1424204075, -670586216, 310598401, 607225278, 1426881987,\r
- 1925078388, -2132889090, -1680079193, -1046744716, -459576895, -272742522,\r
- 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986,\r
- -1740746414, -1473132947, -1341970488, -1084653625, -958395405, -710438585,\r
- 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291,\r
- 1695183700, 1986661051, -2117940946, -1838011259, -1564481375, -1474664885,\r
- -1035236496, -949202525, -778901479, -694614492, -200395387, 275423344,\r
- 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218,\r
- 1537002063, 1747873779, 1955562222, 2024104815, -2067236844, -1933114872,\r
- -1866530822, -1538233109, -1090935817, -965641998\r
- ];\r
- \r
- function binb(m, l) {\r
- var HASH = [1779033703, -1150833019, 1013904242, -1521486534,\r
- 1359893119, -1694144372, 528734635, 1541459225];\r
- var W = new Array(64);\r
- var a, b, c, d, e, f, g, h;\r
- var i, j, T1, T2;\r
- \r
- /* append padding */\r
- m[l >> 5] |= 0x80 << (24 - l % 32);\r
- m[((l + 64 >> 9) << 4) + 15] = l;\r
- \r
- for (i = 0; i < m.length; i += 16)\r
- {\r
- a = HASH[0];\r
- b = HASH[1];\r
- c = HASH[2];\r
- d = HASH[3];\r
- e = HASH[4];\r
- f = HASH[5];\r
- g = HASH[6];\r
- h = HASH[7];\r
- \r
- for (j = 0; j < 64; j+=1)\r
- {\r
- if (j < 16) { \r
- W[j] = m[j + i];\r
- } else { \r
- W[j] = safe_add(safe_add(safe_add(sha256_Gamma1256(W[j - 2]), W[j - 7]),\r
- sha256_Gamma0256(W[j - 15])), W[j - 16]);\r
- }\r
- \r
- T1 = safe_add(safe_add(safe_add(safe_add(h, sha256_Sigma1256(e)), sha256_Ch(e, f, g)),\r
- sha256_K[j]), W[j]);\r
- T2 = safe_add(sha256_Sigma0256(a), sha256_Maj(a, b, c));\r
- h = g;\r
- g = f;\r
- f = e;\r
- e = safe_add(d, T1);\r
- d = c;\r
- c = b;\r
- b = a;\r
- a = safe_add(T1, T2);\r
- }\r
- \r
- HASH[0] = safe_add(a, HASH[0]);\r
- HASH[1] = safe_add(b, HASH[1]);\r
- HASH[2] = safe_add(c, HASH[2]);\r
- HASH[3] = safe_add(d, HASH[3]);\r
- HASH[4] = safe_add(e, HASH[4]);\r
- HASH[5] = safe_add(f, HASH[5]);\r
- HASH[6] = safe_add(g, HASH[6]);\r
- HASH[7] = safe_add(h, HASH[7]);\r
- }\r
- return HASH;\r
- }\r
-\r
- },\r
-\r
- /**\r
- * @class Hashes.SHA512\r
- * @param {config}\r
- * \r
- * A JavaScript implementation of the Secure Hash Algorithm, SHA-512, as defined in FIPS 180-2\r
- * Version 2.2 Copyright Anonymous Contributor, Paul Johnston 2000 - 2009.\r
- * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\r
- * See http://pajhome.org.uk/crypt/md5 for details. \r
- */\r
- SHA512 : function (options) {\r
- /**\r
- * Private properties configuration variables. You may need to tweak these to be compatible with\r
- * the server-side, but the defaults work in most cases.\r
- * @see this.setUpperCase() method\r
- * @see this.setPad() method\r
- */\r
- var hexcase = (options && typeof options.uppercase === 'boolean') ? options.uppercase : false , /* hexadecimal output case format. false - lowercase; true - uppercase */\r
- b64pad = (options && typeof options.pad === 'string') ? options.pda : '=', /* base-64 pad character. Default '=' for strict RFC compliance */\r
- utf8 = (options && typeof options.utf8 === 'boolean') ? options.utf8 : true, /* enable/disable utf8 encoding */\r
- sha512_k;\r
-\r
- /* privileged (public) methods */\r
- this.hex = function (s) { \r
- return rstr2hex(rstr(s)); \r
- };\r
- this.b64 = function (s) { \r
- return rstr2b64(rstr(s), b64pad); \r
- };\r
- this.any = function (s, e) { \r
- return rstr2any(rstr(s), e);\r
- };\r
- this.hex_hmac = function (k, d) {\r
- return rstr2hex(rstr_hmac(k, d));\r
- };\r
- this.b64_hmac = function (k, d) { \r
- return rstr2b64(rstr_hmac(k, d), b64pad);\r
- };\r
- this.any_hmac = function (k, d, e) { \r
- return rstr2any(rstr_hmac(k, d), e);\r
- };\r
- /**\r
- * Perform a simple self-test to see if the VM is working\r
- * @return {String} Hexadecimal hash sample\r
- * @public\r
- */\r
- this.vm_test = function () {\r
- return hex('abc').toLowerCase() === '900150983cd24fb0d6963f7d28e17f72';\r
- };\r
- /** \r
- * @description Enable/disable uppercase hexadecimal returned string \r
- * @param {boolean} \r
- * @return {Object} this\r
- * @public\r
- */ \r
- this.setUpperCase = function (a) {\r
- if (typeof a === 'boolean') {\r
- hexcase = a;\r
- }\r
- return this;\r
- };\r
- /** \r
- * @description Defines a base64 pad string \r
- * @param {string} Pad\r
- * @return {Object} this\r
- * @public\r
- */ \r
- this.setPad = function (a) {\r
- b64pad = a || b64pad;\r
- return this;\r
- };\r
- /** \r
- * @description Defines a base64 pad string \r
- * @param {boolean} \r
- * @return {Object} this\r
- * @public\r
- */ \r
- this.setUTF8 = function (a) {\r
- if (typeof a === 'boolean') {\r
- utf8 = a;\r
- }\r
- return this;\r
- };\r
-\r
- /* private methods */\r
- \r
- /**\r
- * Calculate the SHA-512 of a raw string\r
- */\r
- function rstr(s) {\r
- s = (utf8) ? utf8Encode(s) : s;\r
- return binb2rstr(binb(rstr2binb(s), s.length * 8));\r
- }\r
- /*\r
- * Calculate the HMAC-SHA-512 of a key and some data (raw strings)\r
- */\r
- function rstr_hmac(key, data) {\r
- key = (utf8) ? utf8Encode(key) : key;\r
- data = (utf8) ? utf8Encode(data) : data;\r
- \r
- var hash, i = 0, \r
- bkey = rstr2binb(key),\r
- ipad = Array(32), opad = Array(32);\r
-\r
- if (bkey.length > 32) { bkey = binb(bkey, key.length * 8); }\r
- \r
- for (; i < 32; i+=1) {\r
- ipad[i] = bkey[i] ^ 0x36363636;\r
- opad[i] = bkey[i] ^ 0x5C5C5C5C;\r
- }\r
- \r
- hash = binb(ipad.concat(rstr2binb(data)), 1024 + data.length * 8);\r
- return binb2rstr(binb(opad.concat(hash), 1024 + 512));\r
- }\r
- \r
- /**\r
- * Calculate the SHA-512 of an array of big-endian dwords, and a bit length\r
- */\r
- function binb(x, len) {\r
- var j, i, l,\r
- W = new Array(80),\r
- hash = new Array(16),\r
- //Initial hash values\r
- H = [\r
- new int64(0x6a09e667, -205731576),\r
- new int64(-1150833019, -2067093701),\r
- new int64(0x3c6ef372, -23791573),\r
- new int64(-1521486534, 0x5f1d36f1),\r
- new int64(0x510e527f, -1377402159),\r
- new int64(-1694144372, 0x2b3e6c1f),\r
- new int64(0x1f83d9ab, -79577749),\r
- new int64(0x5be0cd19, 0x137e2179)\r
- ],\r
- T1 = new int64(0, 0),\r
- T2 = new int64(0, 0),\r
- a = new int64(0,0),\r
- b = new int64(0,0),\r
- c = new int64(0,0),\r
- d = new int64(0,0),\r
- e = new int64(0,0),\r
- f = new int64(0,0),\r
- g = new int64(0,0),\r
- h = new int64(0,0),\r
- //Temporary variables not specified by the document\r
- s0 = new int64(0, 0),\r
- s1 = new int64(0, 0),\r
- Ch = new int64(0, 0),\r
- Maj = new int64(0, 0),\r
- r1 = new int64(0, 0),\r
- r2 = new int64(0, 0),\r
- r3 = new int64(0, 0);\r
-\r
- if (sha512_k === undefined) {\r
- //SHA512 constants\r
- sha512_k = [\r
- new int64(0x428a2f98, -685199838), new int64(0x71374491, 0x23ef65cd),\r
- new int64(-1245643825, -330482897), new int64(-373957723, -2121671748),\r
- new int64(0x3956c25b, -213338824), new int64(0x59f111f1, -1241133031),\r
- new int64(-1841331548, -1357295717), new int64(-1424204075, -630357736),\r
- new int64(-670586216, -1560083902), new int64(0x12835b01, 0x45706fbe),\r
- new int64(0x243185be, 0x4ee4b28c), new int64(0x550c7dc3, -704662302),\r
- new int64(0x72be5d74, -226784913), new int64(-2132889090, 0x3b1696b1),\r
- new int64(-1680079193, 0x25c71235), new int64(-1046744716, -815192428),\r
- new int64(-459576895, -1628353838), new int64(-272742522, 0x384f25e3),\r
- new int64(0xfc19dc6, -1953704523), new int64(0x240ca1cc, 0x77ac9c65),\r
- new int64(0x2de92c6f, 0x592b0275), new int64(0x4a7484aa, 0x6ea6e483),\r
- new int64(0x5cb0a9dc, -1119749164), new int64(0x76f988da, -2096016459),\r
- new int64(-1740746414, -295247957), new int64(-1473132947, 0x2db43210),\r
- new int64(-1341970488, -1728372417), new int64(-1084653625, -1091629340),\r
- new int64(-958395405, 0x3da88fc2), new int64(-710438585, -1828018395),\r
- new int64(0x6ca6351, -536640913), new int64(0x14292967, 0xa0e6e70),\r
- new int64(0x27b70a85, 0x46d22ffc), new int64(0x2e1b2138, 0x5c26c926),\r
- new int64(0x4d2c6dfc, 0x5ac42aed), new int64(0x53380d13, -1651133473),\r
- new int64(0x650a7354, -1951439906), new int64(0x766a0abb, 0x3c77b2a8),\r
- new int64(-2117940946, 0x47edaee6), new int64(-1838011259, 0x1482353b),\r
- new int64(-1564481375, 0x4cf10364), new int64(-1474664885, -1136513023),\r
- new int64(-1035236496, -789014639), new int64(-949202525, 0x654be30),\r
- new int64(-778901479, -688958952), new int64(-694614492, 0x5565a910),\r
- new int64(-200395387, 0x5771202a), new int64(0x106aa070, 0x32bbd1b8),\r
- new int64(0x19a4c116, -1194143544), new int64(0x1e376c08, 0x5141ab53),\r
- new int64(0x2748774c, -544281703), new int64(0x34b0bcb5, -509917016),\r
- new int64(0x391c0cb3, -976659869), new int64(0x4ed8aa4a, -482243893),\r
- new int64(0x5b9cca4f, 0x7763e373), new int64(0x682e6ff3, -692930397),\r
- new int64(0x748f82ee, 0x5defb2fc), new int64(0x78a5636f, 0x43172f60),\r
- new int64(-2067236844, -1578062990), new int64(-1933114872, 0x1a6439ec),\r
- new int64(-1866530822, 0x23631e28), new int64(-1538233109, -561857047),\r
- new int64(-1090935817, -1295615723), new int64(-965641998, -479046869),\r
- new int64(-903397682, -366583396), new int64(-779700025, 0x21c0c207),\r
- new int64(-354779690, -840897762), new int64(-176337025, -294727304),\r
- new int64(0x6f067aa, 0x72176fba), new int64(0xa637dc5, -1563912026),\r
- new int64(0x113f9804, -1090974290), new int64(0x1b710b35, 0x131c471b),\r
- new int64(0x28db77f5, 0x23047d84), new int64(0x32caab7b, 0x40c72493),\r
- new int64(0x3c9ebe0a, 0x15c9bebc), new int64(0x431d67c4, -1676669620),\r
- new int64(0x4cc5d4be, -885112138), new int64(0x597f299c, -60457430),\r
- new int64(0x5fcb6fab, 0x3ad6faec), new int64(0x6c44198c, 0x4a475817)\r
- ];\r
- }\r
- \r
- for (i=0; i<80; i+=1) {\r
- W[i] = new int64(0, 0);\r
- }\r
- \r
- // append padding to the source string. The format is described in the FIPS.\r
- x[len >> 5] |= 0x80 << (24 - (len & 0x1f));\r
- x[((len + 128 >> 10)<< 5) + 31] = len;\r
- l = x.length;\r
- for (i = 0; i<l; i+=32) { //32 dwords is the block size\r
- int64copy(a, H[0]);\r
- int64copy(b, H[1]);\r
- int64copy(c, H[2]);\r
- int64copy(d, H[3]);\r
- int64copy(e, H[4]);\r
- int64copy(f, H[5]);\r
- int64copy(g, H[6]);\r
- int64copy(h, H[7]);\r
- \r
- for (j=0; j<16; j+=1) {\r
- W[j].h = x[i + 2*j];\r
- W[j].l = x[i + 2*j + 1];\r
- }\r
- \r
- for (j=16; j<80; j+=1) {\r
- //sigma1\r
- int64rrot(r1, W[j-2], 19);\r
- int64revrrot(r2, W[j-2], 29);\r
- int64shr(r3, W[j-2], 6);\r
- s1.l = r1.l ^ r2.l ^ r3.l;\r
- s1.h = r1.h ^ r2.h ^ r3.h;\r
- //sigma0\r
- int64rrot(r1, W[j-15], 1);\r
- int64rrot(r2, W[j-15], 8);\r
- int64shr(r3, W[j-15], 7);\r
- s0.l = r1.l ^ r2.l ^ r3.l;\r
- s0.h = r1.h ^ r2.h ^ r3.h;\r
- \r
- int64add4(W[j], s1, W[j-7], s0, W[j-16]);\r
- }\r
- \r
- for (j = 0; j < 80; j+=1) {\r
- //Ch\r
- Ch.l = (e.l & f.l) ^ (~e.l & g.l);\r
- Ch.h = (e.h & f.h) ^ (~e.h & g.h);\r
- \r
- //Sigma1\r
- int64rrot(r1, e, 14);\r
- int64rrot(r2, e, 18);\r
- int64revrrot(r3, e, 9);\r
- s1.l = r1.l ^ r2.l ^ r3.l;\r
- s1.h = r1.h ^ r2.h ^ r3.h;\r
- \r
- //Sigma0\r
- int64rrot(r1, a, 28);\r
- int64revrrot(r2, a, 2);\r
- int64revrrot(r3, a, 7);\r
- s0.l = r1.l ^ r2.l ^ r3.l;\r
- s0.h = r1.h ^ r2.h ^ r3.h;\r
- \r
- //Maj\r
- Maj.l = (a.l & b.l) ^ (a.l & c.l) ^ (b.l & c.l);\r
- Maj.h = (a.h & b.h) ^ (a.h & c.h) ^ (b.h & c.h);\r
- \r
- int64add5(T1, h, s1, Ch, sha512_k[j], W[j]);\r
- int64add(T2, s0, Maj);\r
- \r
- int64copy(h, g);\r
- int64copy(g, f);\r
- int64copy(f, e);\r
- int64add(e, d, T1);\r
- int64copy(d, c);\r
- int64copy(c, b);\r
- int64copy(b, a);\r
- int64add(a, T1, T2);\r
- }\r
- int64add(H[0], H[0], a);\r
- int64add(H[1], H[1], b);\r
- int64add(H[2], H[2], c);\r
- int64add(H[3], H[3], d);\r
- int64add(H[4], H[4], e);\r
- int64add(H[5], H[5], f);\r
- int64add(H[6], H[6], g);\r
- int64add(H[7], H[7], h);\r
- }\r
- \r
- //represent the hash as an array of 32-bit dwords\r
- for (i=0; i<8; i+=1) {\r
- hash[2*i] = H[i].h;\r
- hash[2*i + 1] = H[i].l;\r
- }\r
- return hash;\r
- }\r
- \r
- //A constructor for 64-bit numbers\r
- function int64(h, l) {\r
- this.h = h;\r
- this.l = l;\r
- //this.toString = int64toString;\r
- }\r
- \r
- //Copies src into dst, assuming both are 64-bit numbers\r
- function int64copy(dst, src) {\r
- dst.h = src.h;\r
- dst.l = src.l;\r
- }\r
- \r
- //Right-rotates a 64-bit number by shift\r
- //Won't handle cases of shift>=32\r
- //The function revrrot() is for that\r
- function int64rrot(dst, x, shift) {\r
- dst.l = (x.l >>> shift) | (x.h << (32-shift));\r
- dst.h = (x.h >>> shift) | (x.l << (32-shift));\r
- }\r
- \r
- //Reverses the dwords of the source and then rotates right by shift.\r
- //This is equivalent to rotation by 32+shift\r
- function int64revrrot(dst, x, shift) {\r
- dst.l = (x.h >>> shift) | (x.l << (32-shift));\r
- dst.h = (x.l >>> shift) | (x.h << (32-shift));\r
- }\r
- \r
- //Bitwise-shifts right a 64-bit number by shift\r
- //Won't handle shift>=32, but it's never needed in SHA512\r
- function int64shr(dst, x, shift) {\r
- dst.l = (x.l >>> shift) | (x.h << (32-shift));\r
- dst.h = (x.h >>> shift);\r
- }\r
- \r
- //Adds two 64-bit numbers\r
- //Like the original implementation, does not rely on 32-bit operations\r
- function int64add(dst, x, y) {\r
- var w0 = (x.l & 0xffff) + (y.l & 0xffff);\r
- var w1 = (x.l >>> 16) + (y.l >>> 16) + (w0 >>> 16);\r
- var w2 = (x.h & 0xffff) + (y.h & 0xffff) + (w1 >>> 16);\r
- var w3 = (x.h >>> 16) + (y.h >>> 16) + (w2 >>> 16);\r
- dst.l = (w0 & 0xffff) | (w1 << 16);\r
- dst.h = (w2 & 0xffff) | (w3 << 16);\r
- }\r
- \r
- //Same, except with 4 addends. Works faster than adding them one by one.\r
- function int64add4(dst, a, b, c, d) {\r
- var w0 = (a.l & 0xffff) + (b.l & 0xffff) + (c.l & 0xffff) + (d.l & 0xffff);\r
- var w1 = (a.l >>> 16) + (b.l >>> 16) + (c.l >>> 16) + (d.l >>> 16) + (w0 >>> 16);\r
- var w2 = (a.h & 0xffff) + (b.h & 0xffff) + (c.h & 0xffff) + (d.h & 0xffff) + (w1 >>> 16);\r
- var w3 = (a.h >>> 16) + (b.h >>> 16) + (c.h >>> 16) + (d.h >>> 16) + (w2 >>> 16);\r
- dst.l = (w0 & 0xffff) | (w1 << 16);\r
- dst.h = (w2 & 0xffff) | (w3 << 16);\r
- }\r
- \r
- //Same, except with 5 addends\r
- function int64add5(dst, a, b, c, d, e) {\r
- var w0 = (a.l & 0xffff) + (b.l & 0xffff) + (c.l & 0xffff) + (d.l & 0xffff) + (e.l & 0xffff),\r
- w1 = (a.l >>> 16) + (b.l >>> 16) + (c.l >>> 16) + (d.l >>> 16) + (e.l >>> 16) + (w0 >>> 16),\r
- w2 = (a.h & 0xffff) + (b.h & 0xffff) + (c.h & 0xffff) + (d.h & 0xffff) + (e.h & 0xffff) + (w1 >>> 16),\r
- w3 = (a.h >>> 16) + (b.h >>> 16) + (c.h >>> 16) + (d.h >>> 16) + (e.h >>> 16) + (w2 >>> 16);\r
- dst.l = (w0 & 0xffff) | (w1 << 16);\r
- dst.h = (w2 & 0xffff) | (w3 << 16);\r
- }\r
- },\r
- /**\r
- * @class Hashes.RMD160\r
- * @constructor\r
- * @param {Object} [config]\r
- * \r
- * A JavaScript implementation of the RIPEMD-160 Algorithm\r
- * Version 2.2 Copyright Jeremy Lin, Paul Johnston 2000 - 2009.\r
- * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\r
- * See http://pajhome.org.uk/crypt/md5 for details.\r
- * Also http://www.ocf.berkeley.edu/~jjlin/jsotp/\r
- */\r
- RMD160 : function (options) {\r
- /**\r
- * Private properties configuration variables. You may need to tweak these to be compatible with\r
- * the server-side, but the defaults work in most cases.\r
- * @see this.setUpperCase() method\r
- * @see this.setPad() method\r
- */\r
- var hexcase = (options && typeof options.uppercase === 'boolean') ? options.uppercase : false, /* hexadecimal output case format. false - lowercase; true - uppercase */\r
- b64pad = (options && typeof options.pad === 'string') ? options.pda : '=', /* base-64 pad character. Default '=' for strict RFC compliance */\r
- utf8 = (options && typeof options.utf8 === 'boolean') ? options.utf8 : true, /* enable/disable utf8 encoding */\r
- rmd160_r1 = [\r
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\r
- 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,\r
- 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,\r
- 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,\r
- 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13\r
- ],\r
- rmd160_r2 = [\r
- 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,\r
- 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,\r
- 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,\r
- 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,\r
- 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11\r
- ],\r
- rmd160_s1 = [\r
- 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,\r
- 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,\r
- 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,\r
- 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,\r
- 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6\r
- ],\r
- rmd160_s2 = [\r
- 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,\r
- 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,\r
- 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,\r
- 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,\r
- 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11\r
- ];\r
-\r
- /* privileged (public) methods */\r
- this.hex = function (s) {\r
- return rstr2hex(rstr(s, utf8)); \r
- };\r
- this.b64 = function (s) {\r
- return rstr2b64(rstr(s, utf8), b64pad);\r
- };\r
- this.any = function (s, e) { \r
- return rstr2any(rstr(s, utf8), e);\r
- };\r
- this.hex_hmac = function (k, d) { \r
- return rstr2hex(rstr_hmac(k, d));\r
- };\r
- this.b64_hmac = function (k, d) { \r
- return rstr2b64(rstr_hmac(k, d), b64pad);\r
- };\r
- this.any_hmac = function (k, d, e) { \r
- return rstr2any(rstr_hmac(k, d), e); \r
- };\r
- /**\r
- * Perform a simple self-test to see if the VM is working\r
- * @return {String} Hexadecimal hash sample\r
- * @public\r
- */\r
- this.vm_test = function () {\r
- return hex('abc').toLowerCase() === '900150983cd24fb0d6963f7d28e17f72';\r
- };\r
- /** \r
- * @description Enable/disable uppercase hexadecimal returned string \r
- * @param {boolean} \r
- * @return {Object} this\r
- * @public\r
- */ \r
- this.setUpperCase = function (a) {\r
- if (typeof a === 'boolean' ) { hexcase = a; }\r
- return this;\r
- };\r
- /** \r
- * @description Defines a base64 pad string \r
- * @param {string} Pad\r
- * @return {Object} this\r
- * @public\r
- */ \r
- this.setPad = function (a) {\r
- if (typeof a !== 'undefined' ) { b64pad = a; }\r
- return this;\r
- };\r
- /** \r
- * @description Defines a base64 pad string \r
- * @param {boolean} \r
- * @return {Object} this\r
- * @public\r
- */ \r
- this.setUTF8 = function (a) {\r
- if (typeof a === 'boolean') { utf8 = a; }\r
- return this;\r
- };\r
-\r
- /* private methods */\r
-\r
- /**\r
- * Calculate the rmd160 of a raw string\r
- */\r
- function rstr(s) {\r
- s = (utf8) ? utf8Encode(s) : s;\r
- return binl2rstr(binl(rstr2binl(s), s.length * 8));\r
- }\r
-\r
- /**\r
- * Calculate the HMAC-rmd160 of a key and some data (raw strings)\r
- */\r
- function rstr_hmac(key, data) {\r
- key = (utf8) ? utf8Encode(key) : key;\r
- data = (utf8) ? utf8Encode(data) : data;\r
- var i, hash,\r
- bkey = rstr2binl(key),\r
- ipad = Array(16), opad = Array(16);\r
-\r
- if (bkey.length > 16) { \r
- bkey = binl(bkey, key.length * 8); \r
- }\r
- \r
- for (i = 0; i < 16; i+=1) {\r
- ipad[i] = bkey[i] ^ 0x36363636;\r
- opad[i] = bkey[i] ^ 0x5C5C5C5C;\r
- }\r
- hash = binl(ipad.concat(rstr2binl(data)), 512 + data.length * 8);\r
- return binl2rstr(binl(opad.concat(hash), 512 + 160));\r
- }\r
-\r
- /**\r
- * Convert an array of little-endian words to a string\r
- */\r
- function binl2rstr(input) {\r
- var i, output = '', l = input.length * 32;\r
- for (i = 0; i < l; i += 8) {\r
- output += String.fromCharCode((input[i>>5] >>> (i % 32)) & 0xFF);\r
- }\r
- return output;\r
- }\r
-\r
- /**\r
- * Calculate the RIPE-MD160 of an array of little-endian words, and a bit length.\r
- */\r
- function binl(x, len) {\r
- var T, j, i, l,\r
- h0 = 0x67452301,\r
- h1 = 0xefcdab89,\r
- h2 = 0x98badcfe,\r
- h3 = 0x10325476,\r
- h4 = 0xc3d2e1f0,\r
- A1, B1, C1, D1, E1,\r
- A2, B2, C2, D2, E2;\r
-\r
- /* append padding */\r
- x[len >> 5] |= 0x80 << (len % 32);\r
- x[(((len + 64) >>> 9) << 4) + 14] = len;\r
- l = x.length;\r
- \r
- for (i = 0; i < l; i+=16) {\r
- A1 = A2 = h0; B1 = B2 = h1; C1 = C2 = h2; D1 = D2 = h3; E1 = E2 = h4;\r
- for (j = 0; j <= 79; j+=1) {\r
- T = safe_add(A1, rmd160_f(j, B1, C1, D1));\r
- T = safe_add(T, x[i + rmd160_r1[j]]);\r
- T = safe_add(T, rmd160_K1(j));\r
- T = safe_add(bit_rol(T, rmd160_s1[j]), E1);\r
- A1 = E1; E1 = D1; D1 = bit_rol(C1, 10); C1 = B1; B1 = T;\r
- T = safe_add(A2, rmd160_f(79-j, B2, C2, D2));\r
- T = safe_add(T, x[i + rmd160_r2[j]]);\r
- T = safe_add(T, rmd160_K2(j));\r
- T = safe_add(bit_rol(T, rmd160_s2[j]), E2);\r
- A2 = E2; E2 = D2; D2 = bit_rol(C2, 10); C2 = B2; B2 = T;\r
- }\r
-\r
- T = safe_add(h1, safe_add(C1, D2));\r
- h1 = safe_add(h2, safe_add(D1, E2));\r
- h2 = safe_add(h3, safe_add(E1, A2));\r
- h3 = safe_add(h4, safe_add(A1, B2));\r
- h4 = safe_add(h0, safe_add(B1, C2));\r
- h0 = T;\r
- }\r
- return [h0, h1, h2, h3, h4];\r
- }\r
-\r
- // specific algorithm methods \r
- function rmd160_f(j, x, y, z) {\r
- return ( 0 <= j && j <= 15) ? (x ^ y ^ z) :\r
- (16 <= j && j <= 31) ? (x & y) | (~x & z) :\r
- (32 <= j && j <= 47) ? (x | ~y) ^ z :\r
- (48 <= j && j <= 63) ? (x & z) | (y & ~z) :\r
- (64 <= j && j <= 79) ? x ^ (y | ~z) :\r
- 'rmd160_f: j out of range';\r
- }\r
-\r
- function rmd160_K1(j) {\r
- return ( 0 <= j && j <= 15) ? 0x00000000 :\r
- (16 <= j && j <= 31) ? 0x5a827999 :\r
- (32 <= j && j <= 47) ? 0x6ed9eba1 :\r
- (48 <= j && j <= 63) ? 0x8f1bbcdc :\r
- (64 <= j && j <= 79) ? 0xa953fd4e :\r
- 'rmd160_K1: j out of range';\r
- }\r
-\r
- function rmd160_K2(j){\r
- return ( 0 <= j && j <= 15) ? 0x50a28be6 :\r
- (16 <= j && j <= 31) ? 0x5c4dd124 :\r
- (32 <= j && j <= 47) ? 0x6d703ef3 :\r
- (48 <= j && j <= 63) ? 0x7a6d76e9 :\r
- (64 <= j && j <= 79) ? 0x00000000 :\r
- 'rmd160_K2: j out of range';\r
- }\r
- }\r
-};\r
-\r
- // exposes Hashes\r
- (function( window, undefined ) {\r
- var freeExports = false;\r
- if (typeof exports === 'object' ) {\r
- freeExports = exports;\r
- if (exports && typeof global === 'object' && global && global === global.global ) { window = global; }\r
- }\r
-\r
- if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\r
- // define as an anonymous module, so, through path mapping, it can be aliased\r
- define(function () { return Hashes; });\r
- }\r
- else if ( freeExports ) {\r
- // in Node.js or RingoJS v0.8.0+\r
- if ( typeof module === 'object' && module && module.exports === freeExports ) {\r
- module.exports = Hashes;\r
- }\r
- // in Narwhal or RingoJS v0.7.0-\r
- else {\r
- freeExports.Hashes = Hashes;\r
- }\r
- }\r
- else {\r
- // in a browser or Rhino\r
- window.Hashes = Hashes;\r
- }\r
- }( this ));\r
-}()); // IIFE
-})(window)
-},{}],5:[function(require,module,exports){
-var Keys = Object.keys || objectKeys