corrade-nucleus-nucleons – Blame information for rev
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
2 | office | 1 | /* |
2 | CryptoJS v3.1.2 |
||
3 | code.google.com/p/crypto-js |
||
4 | (c) 2009-2013 by Jeff Mott. All rights reserved. |
||
5 | code.google.com/p/crypto-js/wiki/License |
||
6 | */ |
||
7 | (function () { |
||
8 | // Shortcuts |
||
9 | var C = CryptoJS; |
||
10 | var C_lib = C.lib; |
||
11 | var WordArray = C_lib.WordArray; |
||
12 | var Hasher = C_lib.Hasher; |
||
13 | var C_algo = C.algo; |
||
14 | |||
15 | // Reusable object |
||
16 | var W = []; |
||
17 | |||
18 | /** |
||
19 | * SHA-1 hash algorithm. |
||
20 | */ |
||
21 | var SHA1 = C_algo.SHA1 = Hasher.extend({ |
||
22 | _doReset: function () { |
||
23 | this._hash = new WordArray.init([ |
||
24 | 0x67452301, 0xefcdab89, |
||
25 | 0x98badcfe, 0x10325476, |
||
26 | 0xc3d2e1f0 |
||
27 | ]); |
||
28 | }, |
||
29 | |||
30 | _doProcessBlock: function (M, offset) { |
||
31 | // Shortcut |
||
32 | var H = this._hash.words; |
||
33 | |||
34 | // Working variables |
||
35 | var a = H[0]; |
||
36 | var b = H[1]; |
||
37 | var c = H[2]; |
||
38 | var d = H[3]; |
||
39 | var e = H[4]; |
||
40 | |||
41 | // Computation |
||
42 | for (var i = 0; i < 80; i++) { |
||
43 | if (i < 16) { |
||
44 | W[i] = M[offset + i] | 0; |
||
45 | } else { |
||
46 | var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; |
||
47 | W[i] = (n << 1) | (n >>> 31); |
||
48 | } |
||
49 | |||
50 | var t = ((a << 5) | (a >>> 27)) + e + W[i]; |
||
51 | if (i < 20) { |
||
52 | t += ((b & c) | (~b & d)) + 0x5a827999; |
||
53 | } else if (i < 40) { |
||
54 | t += (b ^ c ^ d) + 0x6ed9eba1; |
||
55 | } else if (i < 60) { |
||
56 | t += ((b & c) | (b & d) | (c & d)) - 0x70e44324; |
||
57 | } else /* if (i < 80) */ { |
||
58 | t += (b ^ c ^ d) - 0x359d3e2a; |
||
59 | } |
||
60 | |||
61 | e = d; |
||
62 | d = c; |
||
63 | c = (b << 30) | (b >>> 2); |
||
64 | b = a; |
||
65 | a = t; |
||
66 | } |
||
67 | |||
68 | // Intermediate hash value |
||
69 | H[0] = (H[0] + a) | 0; |
||
70 | H[1] = (H[1] + b) | 0; |
||
71 | H[2] = (H[2] + c) | 0; |
||
72 | H[3] = (H[3] + d) | 0; |
||
73 | H[4] = (H[4] + e) | 0; |
||
74 | }, |
||
75 | |||
76 | _doFinalize: function () { |
||
77 | // Shortcuts |
||
78 | var data = this._data; |
||
79 | var dataWords = data.words; |
||
80 | |||
81 | var nBitsTotal = this._nDataBytes * 8; |
||
82 | var nBitsLeft = data.sigBytes * 8; |
||
83 | |||
84 | // Add padding |
||
85 | dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); |
||
86 | dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); |
||
87 | dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;><> |
||
88 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; data.sigBytes = dataWords.length * 4;><> |
||
89 | |||
90 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; // Hash final blocks><> |
||
91 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; this._process();><> |
||
92 | |||
93 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; // Return final computed hash><> |
||
94 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; return this._hash;><> |
||
95 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; },><> |
||
96 | |||
97 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; clone: function () {><> |
||
98 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; var clone = Hasher.clone.call(this);><> |
||
99 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; clone._hash = this._hash.clone();><> |
||
100 | |||
101 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; return clone;><> |
||
102 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; }><> |
||
103 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; });><> |
||
104 | |||
105 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; /**><> |
||
106 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; * Shortcut function to the hasher's object interface.><> |
||
107 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; *><> |
||
108 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; * @param {WordArray|string} message The message to hash.><> |
||
109 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; *><> |
||
110 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; * @return {WordArray} The hash.><> |
||
111 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; *><> |
||
112 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; * @static><> |
||
113 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; *><> |
||
114 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; * @example><> |
||
115 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; *><> |
||
116 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; * var hash = CryptoJS.SHA1('message');><> |
||
117 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; * var hash = CryptoJS.SHA1(wordArray);><> |
||
118 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; */><> |
||
119 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; C.SHA1 = Hasher._createHelper(SHA1);><> |
||
120 | |||
121 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; /**><> |
||
122 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; * Shortcut function to the HMAC's object interface.><> |
||
123 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; *><> |
||
124 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; * @param {WordArray|string} message The message to hash.><> |
||
125 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; * @param {WordArray|string} key The secret key.><> |
||
126 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; *><> |
||
127 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; * @return {WordArray} The HMAC.><> |
||
128 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; *><> |
||
129 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; * @static><> |
||
130 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; *><> |
||
131 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; * @example><> |
||
132 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; *><> |
||
133 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; * var hmac = CryptoJS.HmacSHA1(message, key);><> |
||
134 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; */><> |
||
135 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal; C.HmacSHA1 = Hasher._createHmacHelper(SHA1);><> |
||
136 | << 4) + 15] = nBitsTotal;< 4) + 15] = nBitsTotal;}());><> |