From 762feb23a59f5db565b1e9c7ffbe7476264b755f Mon Sep 17 00:00:00 2001 From: Alanscut Date: Thu, 16 Sep 2021 19:48:17 +0800 Subject: [PATCH] chore: rename BF to Blowfish --- grunt/config/modularize.js | 2 +- src/blowfish.js | 10 +++++----- test/blowfish-test.js | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/grunt/config/modularize.js b/grunt/config/modularize.js index 5b1efbc..15b8ecb 100644 --- a/grunt/config/modularize.js +++ b/grunt/config/modularize.js @@ -104,7 +104,7 @@ module.exports = { "components": ["core", "enc-base64", "md5", "evpkdf", "cipher-core", "aes"] }, "blowfish": { - "exports": "CryptoJS.BF", + "exports": "CryptoJS.Blowfish", "components": ["core", "enc-base64", "md5", "evpkdf", "cipher-core", "blowfish"] }, "tripledes": { diff --git a/src/blowfish.js b/src/blowfish.js index 07025e6..60eb220 100644 --- a/src/blowfish.js +++ b/src/blowfish.js @@ -402,9 +402,9 @@ } /** - * BF block cipher algorithm. + * Blowfish block cipher algorithm. */ - var BF = C_algo.BF = BlockCipher.extend({ + var Blowfish = C_algo.Blowfish = BlockCipher.extend({ _doReset: function () { // Skip reset of nRounds has been set before and key did not change if (this._keyPriorReset === this._key) { @@ -444,8 +444,8 @@ * * @example * - * var ciphertext = CryptoJS.BF.encrypt(message, key, cfg); - * var plaintext = CryptoJS.BF.decrypt(ciphertext, key, cfg); + * var ciphertext = CryptoJS.Blowfish.encrypt(message, key, cfg); + * var plaintext = CryptoJS.Blowfish.decrypt(ciphertext, key, cfg); */ - C.BF = BlockCipher._createHelper(BF); + C.Blowfish = BlockCipher._createHelper(Blowfish); }()); diff --git a/test/blowfish-test.js b/test/blowfish-test.js index 7244524..607354a 100644 --- a/test/blowfish-test.js +++ b/test/blowfish-test.js @@ -2,7 +2,7 @@ YUI.add('algo-aes-test', function (Y) { var C = CryptoJS; Y.Test.Runner.add(new Y.Test.Case({ - name: 'BF', + name: 'Blowfish', setUp: function () { this.data = { @@ -11,7 +11,7 @@ YUI.add('algo-aes-test', function (Y) { }, testEncrypt: function () { - let encryptedA = C.BF.encrypt('Test', + let encryptedA = C.Blowfish.encrypt('Test', 'pass', { salt: this.data.saltA, @@ -21,13 +21,13 @@ YUI.add('algo-aes-test', function (Y) { }, testDecrypt: function () { - let encryptedA = C.BF.encrypt('Test', + let encryptedA = C.Blowfish.encrypt('Test', 'pass', { salt: this.data.saltA, hasher: CryptoJS.algo.SHA256 }).toString(); - Y.Assert.areEqual('Test', C.BF.decrypt(encryptedA, 'pass', {hasher: CryptoJS.algo.SHA256}).toString(C.enc.Utf8)); + Y.Assert.areEqual('Test', C.Blowfish.decrypt(encryptedA, 'pass', {hasher: CryptoJS.algo.SHA256}).toString(C.enc.Utf8)); } })); }, '$Rev$');