Skip to content

Commit ec7e1b5

Browse files
committed
Merge branch 'rewrite' of https://github.com/Alanscut/crypto-js into rewrite
2 parents e0b5934 + 06967b6 commit ec7e1b5

File tree

12 files changed

+24
-25
lines changed

12 files changed

+24
-25
lines changed

src/algo/pbkdf2/pbkdf2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class PBKDF2Algo extends Base {
3838
hasher: SHA1Algo,
3939
iterations: 1
4040
},
41-
cfg,
41+
cfg
4242
);
4343
}
4444

src/encoding/enc-base64.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ export const Base64 = {
5454

5555
const triplet = (byte1 << 16) | (byte2 << 8) | byte3;
5656

57-
for (let j = 0;
58-
(j < 4) && (i + j * 0.75 < sigBytes); j++) {
57+
for (let j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {
5958
base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
6059
}
6160
}

src/encoding/enc-utf16.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const Utf16BE = {
5959
}
6060

6161
return new WordArray(words, utf16StrLength * 2);
62-
},
62+
}
6363
};
6464
export const Utf16 = Utf16BE;
6565

@@ -118,5 +118,5 @@ export const Utf16LE = {
118118
}
119119

120120
return new WordArray(words, utf16StrLength * 2);
121-
},
121+
}
122122
};

src/encryption/evpkdf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class EvpKDFAlgo extends Base {
3737
hasher: MD5Algo,
3838
iterations: 1
3939
},
40-
cfg,
40+
cfg
4141
);
4242
}
4343

src/encryption/rc4.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export class RC4DropAlgo extends RC4Algo {
107107
super._doReset.call(this);
108108

109109
// Drop
110-
for (let i = this.cfg.drop; i > 0; i -= 1) {
110+
for (let i = this.cfg.drop; i > 0; i--) {
111111
generateKeystreamWord.call(this);
112112
}
113113
}

src/encryption/tripledes.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ const SBOX_P = [
9797
0xc8000001: 0x800200,
9898
0xd8000001: 0x0,
9999
0xe8000001: 0x8200,
100-
0xf8000001: 0x808002,
100+
0xf8000001: 0x808002
101101
},
102102
{
103103
0x0: 0x40084010,
@@ -163,7 +163,7 @@ const SBOX_P = [
163163
0x1c800000: 0x0,
164164
0x1d800000: 0x4010,
165165
0x1e800000: 0x40080010,
166-
0x1f800000: 0x84000,
166+
0x1f800000: 0x84000
167167
},
168168
{
169169
0x0: 0x104,
@@ -229,7 +229,7 @@ const SBOX_P = [
229229
0x1c80000: 0x4000104,
230230
0x1d80000: 0x4010000,
231231
0x1e80000: 0x4,
232-
0x1f80000: 0x10100,
232+
0x1f80000: 0x10100
233233
},
234234
{
235235
0x0: 0x80401000,
@@ -295,7 +295,7 @@ const SBOX_P = [
295295
0x1c8000: 0x1040,
296296
0x1d8000: 0x80401000,
297297
0x1e8000: 0x400000,
298-
0x1f8000: 0x401040,
298+
0x1f8000: 0x401040
299299
},
300300
{
301301
0x0: 0x80,
@@ -361,7 +361,7 @@ const SBOX_P = [
361361
0x1c800: 0x1000080,
362362
0x1d800: 0x40000,
363363
0x1e800: 0x20040000,
364-
0x1f800: 0x20000080,
364+
0x1f800: 0x20000080
365365
},
366366
{
367367
0x0: 0x10000008,
@@ -427,7 +427,7 @@ const SBOX_P = [
427427
0x1c80: 0x200008,
428428
0x1d80: 0x0,
429429
0x1e80: 0x10000000,
430-
0x1f80: 0x10002008,
430+
0x1f80: 0x10002008
431431
},
432432
{
433433
0x0: 0x100000,
@@ -493,7 +493,7 @@ const SBOX_P = [
493493
0x1c8: 0x100401,
494494
0x1d8: 0x400,
495495
0x1e8: 0x2000400,
496-
0x1f8: 0x100001,
496+
0x1f8: 0x100001
497497
},
498498
{
499499
0x0: 0x8000820,
@@ -559,14 +559,14 @@ const SBOX_P = [
559559
0x8000001c: 0x20800,
560560
0x8000001d: 0x820,
561561
0x8000001e: 0x20020,
562-
0x8000001f: 0x8020800,
563-
},
562+
0x8000001f: 0x8020800
563+
}
564564
];
565565

566566
// Masks that select the SBOX input
567567
const SBOX_MASK = [
568568
0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000,
569-
0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f,
569+
0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f
570570
];
571571

572572
// Swap bits across the left and right words

src/format/format-hex.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ export const HexFormatter = {
3939
parse(input) {
4040
const ciphertext = Hex.parse(input);
4141
return new CipherParams({ ciphertext });
42-
},
42+
}
4343
};

src/pad/pad-ansix923.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ export const AnsiX923 = {
2929

3030
// Remove padding
3131
_data.sigBytes -= nPaddingBytes;
32-
},
32+
}
3333
};

src/pad/pad-iso10126.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ export const Iso10126 = {
2626

2727
// Remove padding
2828
_data.sigBytes -= nPaddingBytes;
29-
},
29+
}
3030
};

src/pad/pad-iso97971.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ export const Iso97971 = {
2424
ZeroPadding.unpad(_data);
2525

2626
// Remove one more byte -- the 0x80 byte
27-
_data.sigBytes -= 1;
28-
},
27+
_data.sigBytes--;
28+
}
2929
};

src/pad/pad-nopadding.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ export const NoPadding = {
66
},
77

88
unpad() {
9-
},
9+
}
1010
};

src/pad/pad-zeropadding.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ export const ZeroPadding = {
2020
const dataWords = _data.words;
2121

2222
// Unpad
23-
for (let i = _data.sigBytes - 1; i >= 0; i -= 1) {
23+
for (let i = _data.sigBytes - 1; i >= 0; i--) {
2424
if (((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) {
2525
_data.sigBytes = i + 1;
2626
break;
2727
}
2828
}
29-
},
29+
}
3030
};

0 commit comments

Comments
 (0)