corrade-nucleus-nucleons – Blame information for rev 4

Subversion Repositories:
Rev:
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 // Check if typed arrays are supported
9 if (typeof ArrayBuffer != 'function') {
10 return;
11 }
12  
13 // Shortcuts
14 var C = CryptoJS;
15 var C_lib = C.lib;
16 var WordArray = C_lib.WordArray;
17  
18 // Reference original init
19 var superInit = WordArray.init;
20  
21 // Augment WordArray.init to handle typed arrays
22 var subInit = WordArray.init = function (typedArray) {
23 // Convert buffers to uint8
24 if (typedArray instanceof ArrayBuffer) {
25 typedArray = new Uint8Array(typedArray);
26 }
27  
28 // Convert other array views to uint8
29 if (
30 typedArray instanceof Int8Array ||
31 typedArray instanceof Uint8ClampedArray ||
32 typedArray instanceof Int16Array ||
33 typedArray instanceof Uint16Array ||
34 typedArray instanceof Int32Array ||
35 typedArray instanceof Uint32Array ||
36 typedArray instanceof Float32Array ||
37 typedArray instanceof Float64Array
38 ) {
39 typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);
40 }
41  
42 // Handle Uint8Array
43 if (typedArray instanceof Uint8Array) {
44 // Shortcut
45 var typedArrayByteLength = typedArray.byteLength;
46  
47 // Extract bytes
48 var words = [];
49 for (var i = 0; i < typedArrayByteLength; i++) {
50 words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8);
51 }
52  
53 // Initialize this word array
54 superInit.call(this, words, typedArrayByteLength);
55 } else {
56 // Else call normal init
57 superInit.apply(this, arguments);
58 }
59 };
60  
61 subInit.prototype = WordArray;
62 }());