spring-jekyll-theme 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +49 -0
- data/_includes/disqus.html +17 -0
- data/_includes/disqus_comments.html +20 -0
- data/_includes/footer.html +23 -0
- data/_includes/google-analytics.html +9 -0
- data/_includes/head.html +21 -0
- data/_includes/header.html +31 -0
- data/_includes/profile.html +21 -0
- data/_includes/social.html +19 -0
- data/_layouts/default.html +20 -0
- data/_layouts/home.html +34 -0
- data/_layouts/page.html +14 -0
- data/_layouts/post.html +43 -0
- data/_sass/spring/_base.scss +272 -0
- data/_sass/spring/_layout.scss +290 -0
- data/_sass/spring/_syntax-highlighting.scss +71 -0
- data/_sass/spring.scss +56 -0
- data/assets/3rd-party/crypto-js/CONTRIBUTING.md +28 -0
- data/assets/3rd-party/crypto-js/LICENSE +24 -0
- data/assets/3rd-party/crypto-js/README.md +249 -0
- data/assets/3rd-party/crypto-js/aes.js +234 -0
- data/assets/3rd-party/crypto-js/bower.json +35 -0
- data/assets/3rd-party/crypto-js/cipher-core.js +890 -0
- data/assets/3rd-party/crypto-js/core.js +797 -0
- data/assets/3rd-party/crypto-js/crypto-js.js +6059 -0
- data/assets/3rd-party/crypto-js/docs/QuickStartGuide.wiki +470 -0
- data/assets/3rd-party/crypto-js/enc-base64.js +136 -0
- data/assets/3rd-party/crypto-js/enc-hex.js +18 -0
- data/assets/3rd-party/crypto-js/enc-latin1.js +18 -0
- data/assets/3rd-party/crypto-js/enc-utf16.js +149 -0
- data/assets/3rd-party/crypto-js/enc-utf8.js +18 -0
- data/assets/3rd-party/crypto-js/evpkdf.js +134 -0
- data/assets/3rd-party/crypto-js/format-hex.js +66 -0
- data/assets/3rd-party/crypto-js/format-openssl.js +18 -0
- data/assets/3rd-party/crypto-js/hmac-md5.js +18 -0
- data/assets/3rd-party/crypto-js/hmac-ripemd160.js +18 -0
- data/assets/3rd-party/crypto-js/hmac-sha1.js +18 -0
- data/assets/3rd-party/crypto-js/hmac-sha224.js +18 -0
- data/assets/3rd-party/crypto-js/hmac-sha256.js +18 -0
- data/assets/3rd-party/crypto-js/hmac-sha3.js +18 -0
- data/assets/3rd-party/crypto-js/hmac-sha384.js +18 -0
- data/assets/3rd-party/crypto-js/hmac-sha512.js +18 -0
- data/assets/3rd-party/crypto-js/hmac.js +143 -0
- data/assets/3rd-party/crypto-js/index.js +18 -0
- data/assets/3rd-party/crypto-js/lib-typedarrays.js +76 -0
- data/assets/3rd-party/crypto-js/md5.js +268 -0
- data/assets/3rd-party/crypto-js/mode-cfb.js +80 -0
- data/assets/3rd-party/crypto-js/mode-ctr-gladman.js +116 -0
- data/assets/3rd-party/crypto-js/mode-ctr.js +58 -0
- data/assets/3rd-party/crypto-js/mode-ecb.js +40 -0
- data/assets/3rd-party/crypto-js/mode-ofb.js +54 -0
- data/assets/3rd-party/crypto-js/package.json +66 -0
- data/assets/3rd-party/crypto-js/pad-ansix923.js +49 -0
- data/assets/3rd-party/crypto-js/pad-iso10126.js +44 -0
- data/assets/3rd-party/crypto-js/pad-iso97971.js +40 -0
- data/assets/3rd-party/crypto-js/pad-nopadding.js +30 -0
- data/assets/3rd-party/crypto-js/pad-pkcs7.js +18 -0
- data/assets/3rd-party/crypto-js/pad-zeropadding.js +47 -0
- data/assets/3rd-party/crypto-js/pbkdf2.js +145 -0
- data/assets/3rd-party/crypto-js/rabbit-legacy.js +190 -0
- data/assets/3rd-party/crypto-js/rabbit.js +192 -0
- data/assets/3rd-party/crypto-js/rc4.js +139 -0
- data/assets/3rd-party/crypto-js/ripemd160.js +267 -0
- data/assets/3rd-party/crypto-js/sha1.js +150 -0
- data/assets/3rd-party/crypto-js/sha224.js +80 -0
- data/assets/3rd-party/crypto-js/sha256.js +199 -0
- data/assets/3rd-party/crypto-js/sha3.js +326 -0
- data/assets/3rd-party/crypto-js/sha384.js +83 -0
- data/assets/3rd-party/crypto-js/sha512.js +326 -0
- data/assets/3rd-party/crypto-js/tripledes.js +779 -0
- data/assets/3rd-party/crypto-js/x64-core.js +304 -0
- data/assets/css/style.scss +5 -0
- data/assets/ecmascripts/index.js +25 -0
- data/assets/images/avatar.png +0 -0
- data/assets/images/background.jpg +0 -0
- data/assets/social-icons.svg +28 -0
- metadata +176 -0
@@ -0,0 +1,192 @@
|
|
1
|
+
;(function (root, factory, undef) {
|
2
|
+
if (typeof exports === "object") {
|
3
|
+
// CommonJS
|
4
|
+
module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
|
5
|
+
}
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
7
|
+
// AMD
|
8
|
+
define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
|
9
|
+
}
|
10
|
+
else {
|
11
|
+
// Global (browser)
|
12
|
+
factory(root.CryptoJS);
|
13
|
+
}
|
14
|
+
}(this, function (CryptoJS) {
|
15
|
+
|
16
|
+
(function () {
|
17
|
+
// Shortcuts
|
18
|
+
var C = CryptoJS;
|
19
|
+
var C_lib = C.lib;
|
20
|
+
var StreamCipher = C_lib.StreamCipher;
|
21
|
+
var C_algo = C.algo;
|
22
|
+
|
23
|
+
// Reusable objects
|
24
|
+
var S = [];
|
25
|
+
var C_ = [];
|
26
|
+
var G = [];
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Rabbit stream cipher algorithm
|
30
|
+
*/
|
31
|
+
var Rabbit = C_algo.Rabbit = StreamCipher.extend({
|
32
|
+
_doReset: function () {
|
33
|
+
// Shortcuts
|
34
|
+
var K = this._key.words;
|
35
|
+
var iv = this.cfg.iv;
|
36
|
+
|
37
|
+
// Swap endian
|
38
|
+
for (var i = 0; i < 4; i++) {
|
39
|
+
K[i] = (((K[i] << 8) | (K[i] >>> 24)) & 0x00ff00ff) |
|
40
|
+
(((K[i] << 24) | (K[i] >>> 8)) & 0xff00ff00);
|
41
|
+
}
|
42
|
+
|
43
|
+
// Generate initial state values
|
44
|
+
var X = this._X = [
|
45
|
+
K[0], (K[3] << 16) | (K[2] >>> 16),
|
46
|
+
K[1], (K[0] << 16) | (K[3] >>> 16),
|
47
|
+
K[2], (K[1] << 16) | (K[0] >>> 16),
|
48
|
+
K[3], (K[2] << 16) | (K[1] >>> 16)
|
49
|
+
];
|
50
|
+
|
51
|
+
// Generate initial counter values
|
52
|
+
var C = this._C = [
|
53
|
+
(K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
|
54
|
+
(K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
|
55
|
+
(K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
|
56
|
+
(K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)
|
57
|
+
];
|
58
|
+
|
59
|
+
// Carry bit
|
60
|
+
this._b = 0;
|
61
|
+
|
62
|
+
// Iterate the system four times
|
63
|
+
for (var i = 0; i < 4; i++) {
|
64
|
+
nextState.call(this);
|
65
|
+
}
|
66
|
+
|
67
|
+
// Modify the counters
|
68
|
+
for (var i = 0; i < 8; i++) {
|
69
|
+
C[i] ^= X[(i + 4) & 7];
|
70
|
+
}
|
71
|
+
|
72
|
+
// IV setup
|
73
|
+
if (iv) {
|
74
|
+
// Shortcuts
|
75
|
+
var IV = iv.words;
|
76
|
+
var IV_0 = IV[0];
|
77
|
+
var IV_1 = IV[1];
|
78
|
+
|
79
|
+
// Generate four subvectors
|
80
|
+
var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);
|
81
|
+
var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);
|
82
|
+
var i1 = (i0 >>> 16) | (i2 & 0xffff0000);
|
83
|
+
var i3 = (i2 << 16) | (i0 & 0x0000ffff);
|
84
|
+
|
85
|
+
// Modify counter values
|
86
|
+
C[0] ^= i0;
|
87
|
+
C[1] ^= i1;
|
88
|
+
C[2] ^= i2;
|
89
|
+
C[3] ^= i3;
|
90
|
+
C[4] ^= i0;
|
91
|
+
C[5] ^= i1;
|
92
|
+
C[6] ^= i2;
|
93
|
+
C[7] ^= i3;
|
94
|
+
|
95
|
+
// Iterate the system four times
|
96
|
+
for (var i = 0; i < 4; i++) {
|
97
|
+
nextState.call(this);
|
98
|
+
}
|
99
|
+
}
|
100
|
+
},
|
101
|
+
|
102
|
+
_doProcessBlock: function (M, offset) {
|
103
|
+
// Shortcut
|
104
|
+
var X = this._X;
|
105
|
+
|
106
|
+
// Iterate the system
|
107
|
+
nextState.call(this);
|
108
|
+
|
109
|
+
// Generate four keystream words
|
110
|
+
S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);
|
111
|
+
S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);
|
112
|
+
S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);
|
113
|
+
S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);
|
114
|
+
|
115
|
+
for (var i = 0; i < 4; i++) {
|
116
|
+
// Swap endian
|
117
|
+
S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) |
|
118
|
+
(((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00);
|
119
|
+
|
120
|
+
// Encrypt
|
121
|
+
M[offset + i] ^= S[i];
|
122
|
+
}
|
123
|
+
},
|
124
|
+
|
125
|
+
blockSize: 128/32,
|
126
|
+
|
127
|
+
ivSize: 64/32
|
128
|
+
});
|
129
|
+
|
130
|
+
function nextState() {
|
131
|
+
// Shortcuts
|
132
|
+
var X = this._X;
|
133
|
+
var C = this._C;
|
134
|
+
|
135
|
+
// Save old counter values
|
136
|
+
for (var i = 0; i < 8; i++) {
|
137
|
+
C_[i] = C[i];
|
138
|
+
}
|
139
|
+
|
140
|
+
// Calculate new counter values
|
141
|
+
C[0] = (C[0] + 0x4d34d34d + this._b) | 0;
|
142
|
+
C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0;
|
143
|
+
C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0;
|
144
|
+
C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0;
|
145
|
+
C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0;
|
146
|
+
C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0;
|
147
|
+
C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0;
|
148
|
+
C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0;
|
149
|
+
this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0;
|
150
|
+
|
151
|
+
// Calculate the g-values
|
152
|
+
for (var i = 0; i < 8; i++) {
|
153
|
+
var gx = X[i] + C[i];
|
154
|
+
|
155
|
+
// Construct high and low argument for squaring
|
156
|
+
var ga = gx & 0xffff;
|
157
|
+
var gb = gx >>> 16;
|
158
|
+
|
159
|
+
// Calculate high and low result of squaring
|
160
|
+
var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;
|
161
|
+
var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0);
|
162
|
+
|
163
|
+
// High XOR low
|
164
|
+
G[i] = gh ^ gl;
|
165
|
+
}
|
166
|
+
|
167
|
+
// Calculate new state values
|
168
|
+
X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0;
|
169
|
+
X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0;
|
170
|
+
X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0;
|
171
|
+
X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0;
|
172
|
+
X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0;
|
173
|
+
X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0;
|
174
|
+
X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0;
|
175
|
+
X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0;
|
176
|
+
}
|
177
|
+
|
178
|
+
/**
|
179
|
+
* Shortcut functions to the cipher's object interface.
|
180
|
+
*
|
181
|
+
* @example
|
182
|
+
*
|
183
|
+
* var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg);
|
184
|
+
* var plaintext = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg);
|
185
|
+
*/
|
186
|
+
C.Rabbit = StreamCipher._createHelper(Rabbit);
|
187
|
+
}());
|
188
|
+
|
189
|
+
|
190
|
+
return CryptoJS.Rabbit;
|
191
|
+
|
192
|
+
}));
|
@@ -0,0 +1,139 @@
|
|
1
|
+
;(function (root, factory, undef) {
|
2
|
+
if (typeof exports === "object") {
|
3
|
+
// CommonJS
|
4
|
+
module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
|
5
|
+
}
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
7
|
+
// AMD
|
8
|
+
define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
|
9
|
+
}
|
10
|
+
else {
|
11
|
+
// Global (browser)
|
12
|
+
factory(root.CryptoJS);
|
13
|
+
}
|
14
|
+
}(this, function (CryptoJS) {
|
15
|
+
|
16
|
+
(function () {
|
17
|
+
// Shortcuts
|
18
|
+
var C = CryptoJS;
|
19
|
+
var C_lib = C.lib;
|
20
|
+
var StreamCipher = C_lib.StreamCipher;
|
21
|
+
var C_algo = C.algo;
|
22
|
+
|
23
|
+
/**
|
24
|
+
* RC4 stream cipher algorithm.
|
25
|
+
*/
|
26
|
+
var RC4 = C_algo.RC4 = StreamCipher.extend({
|
27
|
+
_doReset: function () {
|
28
|
+
// Shortcuts
|
29
|
+
var key = this._key;
|
30
|
+
var keyWords = key.words;
|
31
|
+
var keySigBytes = key.sigBytes;
|
32
|
+
|
33
|
+
// Init sbox
|
34
|
+
var S = this._S = [];
|
35
|
+
for (var i = 0; i < 256; i++) {
|
36
|
+
S[i] = i;
|
37
|
+
}
|
38
|
+
|
39
|
+
// Key setup
|
40
|
+
for (var i = 0, j = 0; i < 256; i++) {
|
41
|
+
var keyByteIndex = i % keySigBytes;
|
42
|
+
var keyByte = (keyWords[keyByteIndex >>> 2] >>> (24 - (keyByteIndex % 4) * 8)) & 0xff;
|
43
|
+
|
44
|
+
j = (j + S[i] + keyByte) % 256;
|
45
|
+
|
46
|
+
// Swap
|
47
|
+
var t = S[i];
|
48
|
+
S[i] = S[j];
|
49
|
+
S[j] = t;
|
50
|
+
}
|
51
|
+
|
52
|
+
// Counters
|
53
|
+
this._i = this._j = 0;
|
54
|
+
},
|
55
|
+
|
56
|
+
_doProcessBlock: function (M, offset) {
|
57
|
+
M[offset] ^= generateKeystreamWord.call(this);
|
58
|
+
},
|
59
|
+
|
60
|
+
keySize: 256/32,
|
61
|
+
|
62
|
+
ivSize: 0
|
63
|
+
});
|
64
|
+
|
65
|
+
function generateKeystreamWord() {
|
66
|
+
// Shortcuts
|
67
|
+
var S = this._S;
|
68
|
+
var i = this._i;
|
69
|
+
var j = this._j;
|
70
|
+
|
71
|
+
// Generate keystream word
|
72
|
+
var keystreamWord = 0;
|
73
|
+
for (var n = 0; n < 4; n++) {
|
74
|
+
i = (i + 1) % 256;
|
75
|
+
j = (j + S[i]) % 256;
|
76
|
+
|
77
|
+
// Swap
|
78
|
+
var t = S[i];
|
79
|
+
S[i] = S[j];
|
80
|
+
S[j] = t;
|
81
|
+
|
82
|
+
keystreamWord |= S[(S[i] + S[j]) % 256] << (24 - n * 8);
|
83
|
+
}
|
84
|
+
|
85
|
+
// Update counters
|
86
|
+
this._i = i;
|
87
|
+
this._j = j;
|
88
|
+
|
89
|
+
return keystreamWord;
|
90
|
+
}
|
91
|
+
|
92
|
+
/**
|
93
|
+
* Shortcut functions to the cipher's object interface.
|
94
|
+
*
|
95
|
+
* @example
|
96
|
+
*
|
97
|
+
* var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg);
|
98
|
+
* var plaintext = CryptoJS.RC4.decrypt(ciphertext, key, cfg);
|
99
|
+
*/
|
100
|
+
C.RC4 = StreamCipher._createHelper(RC4);
|
101
|
+
|
102
|
+
/**
|
103
|
+
* Modified RC4 stream cipher algorithm.
|
104
|
+
*/
|
105
|
+
var RC4Drop = C_algo.RC4Drop = RC4.extend({
|
106
|
+
/**
|
107
|
+
* Configuration options.
|
108
|
+
*
|
109
|
+
* @property {number} drop The number of keystream words to drop. Default 192
|
110
|
+
*/
|
111
|
+
cfg: RC4.cfg.extend({
|
112
|
+
drop: 192
|
113
|
+
}),
|
114
|
+
|
115
|
+
_doReset: function () {
|
116
|
+
RC4._doReset.call(this);
|
117
|
+
|
118
|
+
// Drop
|
119
|
+
for (var i = this.cfg.drop; i > 0; i--) {
|
120
|
+
generateKeystreamWord.call(this);
|
121
|
+
}
|
122
|
+
}
|
123
|
+
});
|
124
|
+
|
125
|
+
/**
|
126
|
+
* Shortcut functions to the cipher's object interface.
|
127
|
+
*
|
128
|
+
* @example
|
129
|
+
*
|
130
|
+
* var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg);
|
131
|
+
* var plaintext = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg);
|
132
|
+
*/
|
133
|
+
C.RC4Drop = StreamCipher._createHelper(RC4Drop);
|
134
|
+
}());
|
135
|
+
|
136
|
+
|
137
|
+
return CryptoJS.RC4;
|
138
|
+
|
139
|
+
}));
|
@@ -0,0 +1,267 @@
|
|
1
|
+
;(function (root, factory) {
|
2
|
+
if (typeof exports === "object") {
|
3
|
+
// CommonJS
|
4
|
+
module.exports = exports = factory(require("./core"));
|
5
|
+
}
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
7
|
+
// AMD
|
8
|
+
define(["./core"], factory);
|
9
|
+
}
|
10
|
+
else {
|
11
|
+
// Global (browser)
|
12
|
+
factory(root.CryptoJS);
|
13
|
+
}
|
14
|
+
}(this, function (CryptoJS) {
|
15
|
+
|
16
|
+
/** @preserve
|
17
|
+
(c) 2012 by Cédric Mesnil. All rights reserved.
|
18
|
+
|
19
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
20
|
+
|
21
|
+
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
22
|
+
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
23
|
+
|
24
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
25
|
+
*/
|
26
|
+
|
27
|
+
(function (Math) {
|
28
|
+
// Shortcuts
|
29
|
+
var C = CryptoJS;
|
30
|
+
var C_lib = C.lib;
|
31
|
+
var WordArray = C_lib.WordArray;
|
32
|
+
var Hasher = C_lib.Hasher;
|
33
|
+
var C_algo = C.algo;
|
34
|
+
|
35
|
+
// Constants table
|
36
|
+
var _zl = WordArray.create([
|
37
|
+
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
38
|
+
7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
|
39
|
+
3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
|
40
|
+
1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
|
41
|
+
4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]);
|
42
|
+
var _zr = WordArray.create([
|
43
|
+
5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
|
44
|
+
6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
|
45
|
+
15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
|
46
|
+
8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
|
47
|
+
12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]);
|
48
|
+
var _sl = WordArray.create([
|
49
|
+
11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
|
50
|
+
7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
|
51
|
+
11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
|
52
|
+
11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
|
53
|
+
9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ]);
|
54
|
+
var _sr = WordArray.create([
|
55
|
+
8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
|
56
|
+
9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
|
57
|
+
9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
|
58
|
+
15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
|
59
|
+
8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ]);
|
60
|
+
|
61
|
+
var _hl = WordArray.create([ 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]);
|
62
|
+
var _hr = WordArray.create([ 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]);
|
63
|
+
|
64
|
+
/**
|
65
|
+
* RIPEMD160 hash algorithm.
|
66
|
+
*/
|
67
|
+
var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({
|
68
|
+
_doReset: function () {
|
69
|
+
this._hash = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]);
|
70
|
+
},
|
71
|
+
|
72
|
+
_doProcessBlock: function (M, offset) {
|
73
|
+
|
74
|
+
// Swap endian
|
75
|
+
for (var i = 0; i < 16; i++) {
|
76
|
+
// Shortcuts
|
77
|
+
var offset_i = offset + i;
|
78
|
+
var M_offset_i = M[offset_i];
|
79
|
+
|
80
|
+
// Swap
|
81
|
+
M[offset_i] = (
|
82
|
+
(((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
|
83
|
+
(((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
|
84
|
+
);
|
85
|
+
}
|
86
|
+
// Shortcut
|
87
|
+
var H = this._hash.words;
|
88
|
+
var hl = _hl.words;
|
89
|
+
var hr = _hr.words;
|
90
|
+
var zl = _zl.words;
|
91
|
+
var zr = _zr.words;
|
92
|
+
var sl = _sl.words;
|
93
|
+
var sr = _sr.words;
|
94
|
+
|
95
|
+
// Working variables
|
96
|
+
var al, bl, cl, dl, el;
|
97
|
+
var ar, br, cr, dr, er;
|
98
|
+
|
99
|
+
ar = al = H[0];
|
100
|
+
br = bl = H[1];
|
101
|
+
cr = cl = H[2];
|
102
|
+
dr = dl = H[3];
|
103
|
+
er = el = H[4];
|
104
|
+
// Computation
|
105
|
+
var t;
|
106
|
+
for (var i = 0; i < 80; i += 1) {
|
107
|
+
t = (al + M[offset+zl[i]])|0;
|
108
|
+
if (i<16){
|
109
|
+
t += f1(bl,cl,dl) + hl[0];
|
110
|
+
} else if (i<32) {
|
111
|
+
t += f2(bl,cl,dl) + hl[1];
|
112
|
+
} else if (i<48) {
|
113
|
+
t += f3(bl,cl,dl) + hl[2];
|
114
|
+
} else if (i<64) {
|
115
|
+
t += f4(bl,cl,dl) + hl[3];
|
116
|
+
} else {// if (i<80) {
|
117
|
+
t += f5(bl,cl,dl) + hl[4];
|
118
|
+
}
|
119
|
+
t = t|0;
|
120
|
+
t = rotl(t,sl[i]);
|
121
|
+
t = (t+el)|0;
|
122
|
+
al = el;
|
123
|
+
el = dl;
|
124
|
+
dl = rotl(cl, 10);
|
125
|
+
cl = bl;
|
126
|
+
bl = t;
|
127
|
+
|
128
|
+
t = (ar + M[offset+zr[i]])|0;
|
129
|
+
if (i<16){
|
130
|
+
t += f5(br,cr,dr) + hr[0];
|
131
|
+
} else if (i<32) {
|
132
|
+
t += f4(br,cr,dr) + hr[1];
|
133
|
+
} else if (i<48) {
|
134
|
+
t += f3(br,cr,dr) + hr[2];
|
135
|
+
} else if (i<64) {
|
136
|
+
t += f2(br,cr,dr) + hr[3];
|
137
|
+
} else {// if (i<80) {
|
138
|
+
t += f1(br,cr,dr) + hr[4];
|
139
|
+
}
|
140
|
+
t = t|0;
|
141
|
+
t = rotl(t,sr[i]) ;
|
142
|
+
t = (t+er)|0;
|
143
|
+
ar = er;
|
144
|
+
er = dr;
|
145
|
+
dr = rotl(cr, 10);
|
146
|
+
cr = br;
|
147
|
+
br = t;
|
148
|
+
}
|
149
|
+
// Intermediate hash value
|
150
|
+
t = (H[1] + cl + dr)|0;
|
151
|
+
H[1] = (H[2] + dl + er)|0;
|
152
|
+
H[2] = (H[3] + el + ar)|0;
|
153
|
+
H[3] = (H[4] + al + br)|0;
|
154
|
+
H[4] = (H[0] + bl + cr)|0;
|
155
|
+
H[0] = t;
|
156
|
+
},
|
157
|
+
|
158
|
+
_doFinalize: function () {
|
159
|
+
// Shortcuts
|
160
|
+
var data = this._data;
|
161
|
+
var dataWords = data.words;
|
162
|
+
|
163
|
+
var nBitsTotal = this._nDataBytes * 8;
|
164
|
+
var nBitsLeft = data.sigBytes * 8;
|
165
|
+
|
166
|
+
// Add padding
|
167
|
+
dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
|
168
|
+
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
|
169
|
+
(((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) |
|
170
|
+
(((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00)
|
171
|
+
);
|
172
|
+
data.sigBytes = (dataWords.length + 1) * 4;
|
173
|
+
|
174
|
+
// Hash final blocks
|
175
|
+
this._process();
|
176
|
+
|
177
|
+
// Shortcuts
|
178
|
+
var hash = this._hash;
|
179
|
+
var H = hash.words;
|
180
|
+
|
181
|
+
// Swap endian
|
182
|
+
for (var i = 0; i < 5; i++) {
|
183
|
+
// Shortcut
|
184
|
+
var H_i = H[i];
|
185
|
+
|
186
|
+
// Swap
|
187
|
+
H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
|
188
|
+
(((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
|
189
|
+
}
|
190
|
+
|
191
|
+
// Return final computed hash
|
192
|
+
return hash;
|
193
|
+
},
|
194
|
+
|
195
|
+
clone: function () {
|
196
|
+
var clone = Hasher.clone.call(this);
|
197
|
+
clone._hash = this._hash.clone();
|
198
|
+
|
199
|
+
return clone;
|
200
|
+
}
|
201
|
+
});
|
202
|
+
|
203
|
+
|
204
|
+
function f1(x, y, z) {
|
205
|
+
return ((x) ^ (y) ^ (z));
|
206
|
+
|
207
|
+
}
|
208
|
+
|
209
|
+
function f2(x, y, z) {
|
210
|
+
return (((x)&(y)) | ((~x)&(z)));
|
211
|
+
}
|
212
|
+
|
213
|
+
function f3(x, y, z) {
|
214
|
+
return (((x) | (~(y))) ^ (z));
|
215
|
+
}
|
216
|
+
|
217
|
+
function f4(x, y, z) {
|
218
|
+
return (((x) & (z)) | ((y)&(~(z))));
|
219
|
+
}
|
220
|
+
|
221
|
+
function f5(x, y, z) {
|
222
|
+
return ((x) ^ ((y) |(~(z))));
|
223
|
+
|
224
|
+
}
|
225
|
+
|
226
|
+
function rotl(x,n) {
|
227
|
+
return (x<<n) | (x>>>(32-n));
|
228
|
+
}
|
229
|
+
|
230
|
+
|
231
|
+
/**
|
232
|
+
* Shortcut function to the hasher's object interface.
|
233
|
+
*
|
234
|
+
* @param {WordArray|string} message The message to hash.
|
235
|
+
*
|
236
|
+
* @return {WordArray} The hash.
|
237
|
+
*
|
238
|
+
* @static
|
239
|
+
*
|
240
|
+
* @example
|
241
|
+
*
|
242
|
+
* var hash = CryptoJS.RIPEMD160('message');
|
243
|
+
* var hash = CryptoJS.RIPEMD160(wordArray);
|
244
|
+
*/
|
245
|
+
C.RIPEMD160 = Hasher._createHelper(RIPEMD160);
|
246
|
+
|
247
|
+
/**
|
248
|
+
* Shortcut function to the HMAC's object interface.
|
249
|
+
*
|
250
|
+
* @param {WordArray|string} message The message to hash.
|
251
|
+
* @param {WordArray|string} key The secret key.
|
252
|
+
*
|
253
|
+
* @return {WordArray} The HMAC.
|
254
|
+
*
|
255
|
+
* @static
|
256
|
+
*
|
257
|
+
* @example
|
258
|
+
*
|
259
|
+
* var hmac = CryptoJS.HmacRIPEMD160(message, key);
|
260
|
+
*/
|
261
|
+
C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160);
|
262
|
+
}(Math));
|
263
|
+
|
264
|
+
|
265
|
+
return CryptoJS.RIPEMD160;
|
266
|
+
|
267
|
+
}));
|