From c10c3b50485bd880e0c2e7d210b948d4d1df1276 Mon Sep 17 00:00:00 2001 From: Alanscut Date: Fri, 25 Oct 2019 16:19:26 +0800 Subject: [PATCH] change style --- src/algo/pbkdf2/pbkdf2.js | 2 +- src/encoding/enc-base64.js | 3 +-- src/encoding/enc-utf16.js | 4 ++-- src/encryption/evpkdf.js | 2 +- src/encryption/rc4.js | 2 +- src/encryption/tripledes.js | 20 ++++++++++---------- src/format/format-hex.js | 2 +- src/pad/pad-ansix923.js | 2 +- src/pad/pad-iso10126.js | 2 +- src/pad/pad-iso97971.js | 4 ++-- src/pad/pad-nopadding.js | 2 +- src/pad/pad-zeropadding.js | 4 ++-- 12 files changed, 24 insertions(+), 25 deletions(-) diff --git a/src/algo/pbkdf2/pbkdf2.js b/src/algo/pbkdf2/pbkdf2.js index b7170f7..e0b4d20 100644 --- a/src/algo/pbkdf2/pbkdf2.js +++ b/src/algo/pbkdf2/pbkdf2.js @@ -38,7 +38,7 @@ export class PBKDF2Algo extends Base { hasher: SHA1Algo, iterations: 1 }, - cfg, + cfg ); } diff --git a/src/encoding/enc-base64.js b/src/encoding/enc-base64.js index 85ac01f..b22aee7 100644 --- a/src/encoding/enc-base64.js +++ b/src/encoding/enc-base64.js @@ -54,8 +54,7 @@ export const Base64 = { const triplet = (byte1 << 16) | (byte2 << 8) | byte3; - for (let j = 0; - (j < 4) && (i + j * 0.75 < sigBytes); j++) { + for (let j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) { base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f)); } } diff --git a/src/encoding/enc-utf16.js b/src/encoding/enc-utf16.js index b2e6eb3..4ac5190 100644 --- a/src/encoding/enc-utf16.js +++ b/src/encoding/enc-utf16.js @@ -59,7 +59,7 @@ export const Utf16BE = { } return new WordArray(words, utf16StrLength * 2); - }, + } }; export const Utf16 = Utf16BE; @@ -118,5 +118,5 @@ export const Utf16LE = { } return new WordArray(words, utf16StrLength * 2); - }, + } }; diff --git a/src/encryption/evpkdf.js b/src/encryption/evpkdf.js index d44fbbf..3f06b01 100644 --- a/src/encryption/evpkdf.js +++ b/src/encryption/evpkdf.js @@ -37,7 +37,7 @@ export class EvpKDFAlgo extends Base { hasher: MD5Algo, iterations: 1 }, - cfg, + cfg ); } diff --git a/src/encryption/rc4.js b/src/encryption/rc4.js index d901806..aa15044 100644 --- a/src/encryption/rc4.js +++ b/src/encryption/rc4.js @@ -107,7 +107,7 @@ export class RC4DropAlgo extends RC4Algo { super._doReset.call(this); // Drop - for (let i = this.cfg.drop; i > 0; i -= 1) { + for (let i = this.cfg.drop; i > 0; i--) { generateKeystreamWord.call(this); } } diff --git a/src/encryption/tripledes.js b/src/encryption/tripledes.js index 10a83a0..678d383 100644 --- a/src/encryption/tripledes.js +++ b/src/encryption/tripledes.js @@ -97,7 +97,7 @@ const SBOX_P = [ 0xc8000001: 0x800200, 0xd8000001: 0x0, 0xe8000001: 0x8200, - 0xf8000001: 0x808002, + 0xf8000001: 0x808002 }, { 0x0: 0x40084010, @@ -163,7 +163,7 @@ const SBOX_P = [ 0x1c800000: 0x0, 0x1d800000: 0x4010, 0x1e800000: 0x40080010, - 0x1f800000: 0x84000, + 0x1f800000: 0x84000 }, { 0x0: 0x104, @@ -229,7 +229,7 @@ const SBOX_P = [ 0x1c80000: 0x4000104, 0x1d80000: 0x4010000, 0x1e80000: 0x4, - 0x1f80000: 0x10100, + 0x1f80000: 0x10100 }, { 0x0: 0x80401000, @@ -295,7 +295,7 @@ const SBOX_P = [ 0x1c8000: 0x1040, 0x1d8000: 0x80401000, 0x1e8000: 0x400000, - 0x1f8000: 0x401040, + 0x1f8000: 0x401040 }, { 0x0: 0x80, @@ -361,7 +361,7 @@ const SBOX_P = [ 0x1c800: 0x1000080, 0x1d800: 0x40000, 0x1e800: 0x20040000, - 0x1f800: 0x20000080, + 0x1f800: 0x20000080 }, { 0x0: 0x10000008, @@ -427,7 +427,7 @@ const SBOX_P = [ 0x1c80: 0x200008, 0x1d80: 0x0, 0x1e80: 0x10000000, - 0x1f80: 0x10002008, + 0x1f80: 0x10002008 }, { 0x0: 0x100000, @@ -493,7 +493,7 @@ const SBOX_P = [ 0x1c8: 0x100401, 0x1d8: 0x400, 0x1e8: 0x2000400, - 0x1f8: 0x100001, + 0x1f8: 0x100001 }, { 0x0: 0x8000820, @@ -559,14 +559,14 @@ const SBOX_P = [ 0x8000001c: 0x20800, 0x8000001d: 0x820, 0x8000001e: 0x20020, - 0x8000001f: 0x8020800, - }, + 0x8000001f: 0x8020800 + } ]; // Masks that select the SBOX input const SBOX_MASK = [ 0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000, - 0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f, + 0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f ]; // Swap bits across the left and right words diff --git a/src/format/format-hex.js b/src/format/format-hex.js index 3334960..5792d81 100644 --- a/src/format/format-hex.js +++ b/src/format/format-hex.js @@ -39,5 +39,5 @@ export const HexFormatter = { parse(input) { const ciphertext = Hex.parse(input); return new CipherParams({ ciphertext }); - }, + } }; diff --git a/src/pad/pad-ansix923.js b/src/pad/pad-ansix923.js index fab067b..233eff7 100644 --- a/src/pad/pad-ansix923.js +++ b/src/pad/pad-ansix923.js @@ -29,5 +29,5 @@ export const AnsiX923 = { // Remove padding _data.sigBytes -= nPaddingBytes; - }, + } }; diff --git a/src/pad/pad-iso10126.js b/src/pad/pad-iso10126.js index 9c9e36a..ad3e8be 100644 --- a/src/pad/pad-iso10126.js +++ b/src/pad/pad-iso10126.js @@ -26,5 +26,5 @@ export const Iso10126 = { // Remove padding _data.sigBytes -= nPaddingBytes; - }, + } }; diff --git a/src/pad/pad-iso97971.js b/src/pad/pad-iso97971.js index 48cf37f..fd0d446 100644 --- a/src/pad/pad-iso97971.js +++ b/src/pad/pad-iso97971.js @@ -24,6 +24,6 @@ export const Iso97971 = { ZeroPadding.unpad(_data); // Remove one more byte -- the 0x80 byte - _data.sigBytes -= 1; - }, + _data.sigBytes--; + } }; diff --git a/src/pad/pad-nopadding.js b/src/pad/pad-nopadding.js index b0fbf4c..e1ffc0a 100644 --- a/src/pad/pad-nopadding.js +++ b/src/pad/pad-nopadding.js @@ -6,5 +6,5 @@ export const NoPadding = { }, unpad() { - }, + } }; diff --git a/src/pad/pad-zeropadding.js b/src/pad/pad-zeropadding.js index 00db18c..276fa53 100644 --- a/src/pad/pad-zeropadding.js +++ b/src/pad/pad-zeropadding.js @@ -20,11 +20,11 @@ export const ZeroPadding = { const dataWords = _data.words; // Unpad - for (let i = _data.sigBytes - 1; i >= 0; i -= 1) { + for (let i = _data.sigBytes - 1; i >= 0; i--) { if (((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) { _data.sigBytes = i + 1; break; } } - }, + } };