diff --git a/src/core/config/scripts/fixCryptoApiImports.mjs b/src/core/config/scripts/fixCryptoApiImports.mjs
index f4b7c76750..008913c4e5 100644
--- a/src/core/config/scripts/fixCryptoApiImports.mjs
+++ b/src/core/config/scripts/fixCryptoApiImports.mjs
@@ -35,7 +35,7 @@ function walk(dir) {
const content = readFileSync(fullPath, "utf8");
// Add .mjs to imports if not present
- const updated = content.replace(
+ let updated = content.replace(
/from "(\.[^"]*)";/g,
(match, p1) => {
if (p1.endsWith(".mjs")) return match;
@@ -43,6 +43,16 @@ function walk(dir) {
}
);
+ // Patch sha512.mjs default rounds and loop step logic
+ if (entry.name === "sha512.mjs") {
+ updated = updated
+ .replace("options.rounds = options.rounds || 160;", "options.rounds = options.rounds || 80;")
+ .replace("for (let i = 0; i < this.options.rounds; i += 2) {", "for (let i = 0; i < this.options.rounds * 2; i += 2) {")
+ .replace("this.W = new Array(160);", "this.W = new Array(this.options.rounds * 2);")
+ .replace("options.rounds=160", "options.rounds=80")
+ .replace("(Must be greater than 32)", "(Must be greater than 16)");
+ }
+
if (updated !== content) {
writeFileSync(fullPath, updated, "utf8");
}
diff --git a/src/core/operations/SHA2.mjs b/src/core/operations/SHA2.mjs
index 9844070def..52d56a2fc0 100644
--- a/src/core/operations/SHA2.mjs
+++ b/src/core/operations/SHA2.mjs
@@ -20,7 +20,7 @@ class SHA2 extends Operation {
this.name = "SHA2";
this.module = "Crypto";
- this.description = "The SHA-2 (Secure Hash Algorithm 2) hash functions were designed by the NSA. SHA-2 includes significant changes from its predecessor, SHA-1. The SHA-2 family consists of hash functions with digests (hash values) that are 224, 256, 384 or 512 bits: SHA224, SHA256, SHA384, SHA512.