Skip to content

Commit 9727e26

Browse files
authored
update bcryptjs (#2368)
Co-authored-by: GCHQDeveloper581 <63102987+GCHQDeveloper581@users.noreply.github.com> (fixed browser tests)
1 parent 055ae50 commit 9727e26

6 files changed

Lines changed: 15 additions & 12 deletions

File tree

package-lock.json

Lines changed: 8 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,15 @@
9696
"@alexaltea/capstone-js": "^3.0.5",
9797
"@astronautlabs/amf": "^0.0.6",
9898
"@blu3r4y/lzma": "^2.3.3",
99+
"@noble/hashes": "2.2.0",
99100
"@wavesenterprise/crypto-gost-js": "^2.1.0-RC1",
100101
"@xmldom/xmldom": "^0.8.13",
101102
"argon2-browser": "^1.18.0",
102103
"arrive": "^2.5.3",
103104
"assert": "^2.1.0",
104105
"avsc": "^5.7.9",
105-
"bcryptjs": "^2.4.3",
106+
"bcryptjs": "^3.0.3",
106107
"bignumber.js": "^9.3.1",
107-
"@noble/hashes": "2.2.0",
108108
"blakejs": "^1.2.1",
109109
"bootstrap": "4.6.2",
110110
"bootstrap-colorpicker": "^3.4.0",

src/core/operations/Bcrypt.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Bcrypt extends Operation {
4343
const rounds = args[0];
4444
const salt = await bcrypt.genSalt(rounds);
4545

46-
return await bcrypt.hash(input, salt, null, p => {
46+
return await bcrypt.hash(input, salt, undefined, p => {
4747
// Progress callback
4848
if (isWorkerEnvironment())
4949
self.sendStatusMessage(`Progress: ${(p * 100).toFixed(0)}%`);

src/core/operations/BcryptCompare.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class BcryptCompare extends Operation {
4343
async run(input, args) {
4444
const hash = args[0];
4545

46-
const match = await bcrypt.compare(input, hash, null, p => {
46+
const match = await bcrypt.compare(input, hash, undefined, p => {
4747
// Progress callback
4848
if (isWorkerEnvironment())
4949
self.sendStatusMessage(`Progress: ${(p * 100).toFixed(0)}%`);

tests/browser/02_ops.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ module.exports = {
6464
testOp(browser, "BSON serialise", '{"a":"test"}', "\u0011\u0000\u0000\u0000\u0002a\u0000\u0005\u0000\u0000\u0000test\u0000\u0000");
6565
// testOp(browser, "Bacon Cipher Decode", "test input", "test_output");
6666
// testOp(browser, "Bacon Cipher Encode", "test input", "test_output");
67-
testOp(browser, "Bcrypt", "test input", /^\$2a\$06\$.{53}$/, [6]);
67+
testOp(browser, "Bcrypt", "test input", /^\$2b\$06\$.{53}$/, [6]);
6868
testOp(browser, "Bcrypt compare", "test input", "Match: test input", ["$2a$05$FCfBSVX7OeRkK.9kQVFCiOYu9XtwtIbePqUiroD1lkASW9q5QClzG"]);
6969
testOp(browser, "Bcrypt parse", "$2a$05$kXWtAIGB/R8VEzInoM5ocOTBtyc0m2YTIwFiBU/0XoW032f9QrkWW", /Rounds: 5/);
7070
testOp(browser, "Bifid Cipher Decode", "qblb tfovy", "test input", ["pass"]);

tests/node/tests/operations.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ Tiger-128`;
136136
it("Bcrypt", async () => {
137137
const result = await chef.bcrypt("Put a Sock In It");
138138
const strResult = result.toString();
139-
assert.equal(strResult.length, 60);
140-
assert.equal(strResult.slice(0, 7), "$2a$10$");
139+
assert.match(strResult, /^\$2b\$10\$[./A-Za-z0-9]{53}$/);
140+
assert.equal(strResult.split("$").length, 4);
141141
}),
142142

143143
it("bcryptCompare", async() => {

0 commit comments

Comments
 (0)