From 71ad0bcd2cb015021cacdb0120c065e87b7669d2 Mon Sep 17 00:00:00 2001 From: paulmwatson Date: Mon, 11 May 2020 14:44:09 +0200 Subject: [PATCH 01/15] Minor typo fix: varialbes => variables --- src/md5.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/md5.js b/src/md5.js index 5189321..77ae69d 100644 --- a/src/md5.js +++ b/src/md5.js @@ -60,7 +60,7 @@ var M_offset_14 = M[offset + 14]; var M_offset_15 = M[offset + 15]; - // Working varialbes + // Working variables var a = H[0]; var b = H[1]; var c = H[2]; From ecfe2e45f5237f1c27ce614c0a1ea442faa257b6 Mon Sep 17 00:00:00 2001 From: evanvosberg Date: Thu, 22 Jul 2021 15:01:11 +0300 Subject: [PATCH 02/15] Update dev dependencies. --- package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 6726ec7..0bddb88 100644 --- a/package.json +++ b/package.json @@ -27,15 +27,15 @@ "dependencies": {}, "devDependencies": { "fmd": "~0.0.3", - "grunt": "^0.4.5", + "grunt": "^1.3.2", "grunt-cli": "^1.3.2", - "grunt-contrib-clean": "^0.6.0", - "grunt-contrib-copy": "^0.6.0", - "grunt-contrib-jshint": "^2.1.0", - "grunt-jsonlint": "^1.0.4", - "grunt-update-json": "^0.2.0", - "load-grunt-config": "^0.16.0", - "lodash": "^4.17.11" + "grunt-contrib-clean": "^2.0.0", + "grunt-contrib-copy": "^1.0.0", + "grunt-contrib-jshint": "^3.0.0", + "grunt-jsonlint": "^2.1.3", + "grunt-update-json": "^0.2.2", + "load-grunt-config": "^4.0.0", + "lodash": "^4.17.21" }, "keywords": [ "security", From dcc3848f5de5208bca73f36c0ed77fa192ee2ea8 Mon Sep 17 00:00:00 2001 From: Alanscut Date: Mon, 30 Aug 2021 14:28:30 +0800 Subject: [PATCH 03/15] fix:The "cfg.salt" parameter don't work --- src/cipher-core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cipher-core.js b/src/cipher-core.js index 0fe6136..5086638 100644 --- a/src/cipher-core.js +++ b/src/cipher-core.js @@ -819,7 +819,7 @@ CryptoJS.lib.Cipher || (function (undefined) { cfg = this.cfg.extend(cfg); // Derive key and other params - var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize); + var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, cfg.salt); // Add IV to config cfg.iv = derivedParams.iv; From ca7384f8dc3d25437703b7a1899b9928e6379adc Mon Sep 17 00:00:00 2001 From: Alanscut Date: Tue, 31 Aug 2021 11:37:01 +0800 Subject: [PATCH 04/15] test: add test case,using salt in the config --- test/config-test.js | 26 ++++++++++++++++++++++++++ test/test.html | 1 + 2 files changed, 27 insertions(+) create mode 100644 test/config-test.js diff --git a/test/config-test.js b/test/config-test.js new file mode 100644 index 0000000..090e9fd --- /dev/null +++ b/test/config-test.js @@ -0,0 +1,26 @@ +YUI.add('config-test', function (Y) { + var C = CryptoJS; + + Y.Test.Runner.add(new Y.Test.Case({ + name: 'Config', + + setUp: function () { + this.data = { + saltA: CryptoJS.enc.Hex.parse('AA00000000000000'), + saltB: CryptoJS.enc.Hex.parse('BB00000000000000') + }; + }, + + testEncrypt: function () { + Y.Assert.areEqual(C.AES.encrypt('Test', 'Pass', { salt: this.data.saltA }).toString(), C.AES.encrypt('Test', 'Pass', { salt: this.data.saltA }).toString()); + Y.Assert.areNotEqual(C.AES.encrypt('Test', 'Pass', { salt: this.data.saltA }).toString(), C.AES.encrypt('Test', 'Pass', { salt: this.data.saltB }).toString()); + }, + + testDecrypt: function () { + var encryptedA = C.AES.encrypt('Test', 'Pass', { salt: this.data.saltA }); + var encryptedB = C.AES.encrypt('Test', 'Pass', { salt: this.data.saltB }); + Y.Assert.areEqual('Test', C.AES.decrypt(encryptedA, 'Pass').toString(C.enc.Utf8)); + Y.Assert.areEqual('Test', C.AES.decrypt(encryptedB, 'Pass').toString(C.enc.Utf8)); + } + })); +}, '$Rev$'); \ No newline at end of file diff --git a/test/test.html b/test/test.html index d469486..6ab23c2 100644 --- a/test/test.html +++ b/test/test.html @@ -88,6 +88,7 @@ + + @@ -89,6 +90,7 @@ +