OLD | NEW |
1 /* | 1 /* |
2 * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined | 2 * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined |
3 * in FIPS 180-1 | 3 * in FIPS 180-1 |
4 * Version 2.2 Copyright Paul Johnston 2000 - 2009. | 4 * Version 2.2 Copyright Paul Johnston 2000 - 2009. |
5 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet | 5 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet |
6 * Distributed under the BSD License | 6 * Distributed under the BSD License |
7 * See http://pajhome.org.uk/crypt/md5 for details. | 7 * See http://pajhome.org.uk/crypt/md5 for details. |
8 */ | 8 */ |
9 // clang-format off | 9 // clang-format off |
10 /* eslint-disable */ | 10 /* eslint-disable */ |
11 /** | 11 /** |
12 * @param {string} str | 12 * @param {string} str |
13 * @return {string} | 13 * @return {string} |
14 */ | 14 */ |
15 ProductRegistry.sha1 = function(str) { | 15 ProductRegistryImpl.sha1 = function(str) { |
16 return rstr2hex(rstr_sha1(str2rstr_utf8(str))); | 16 return rstr2hex(rstr_sha1(str2rstr_utf8(str))); |
17 | 17 |
18 /** | 18 /** |
19 * Calculate the SHA1 of a raw string | 19 * Calculate the SHA1 of a raw string |
20 * @param {string} s | 20 * @param {string} s |
21 * @return {string} | 21 * @return {string} |
22 */ | 22 */ |
23 function rstr_sha1(s) | 23 function rstr_sha1(s) |
24 { | 24 { |
25 return binb2rstr(binb_sha1(rstr2binb(s), s.length * 8)); | 25 return binb2rstr(binb_sha1(rstr2binb(s), s.length * 8)); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 * Bitwise rotate a 32-bit number to the left. | 211 * Bitwise rotate a 32-bit number to the left. |
212 * @param {number} num | 212 * @param {number} num |
213 * @param {number} cnt | 213 * @param {number} cnt |
214 * @return {number} | 214 * @return {number} |
215 */ | 215 */ |
216 function bit_rol(num, cnt) | 216 function bit_rol(num, cnt) |
217 { | 217 { |
218 return (num << cnt) | (num >>> (32 - cnt)); | 218 return (num << cnt) | (num >>> (32 - cnt)); |
219 } | 219 } |
220 }; | 220 }; |
OLD | NEW |