From e3c1dcea0e23000c1779c71a9e9db0b32433ebb4 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Mon, 1 Apr 2024 21:48:19 +0200 Subject: [PATCH] Bun's crypto.scrypt doesn't block the event loop that much compared to crypto.pbkdf2 --- svr.js | 3 --- svrpasswd.js | 1 - 2 files changed, 4 deletions(-) diff --git a/svr.js b/svr.js index 147ac66..39b6784 100644 --- a/svr.js +++ b/svr.js @@ -4933,9 +4933,6 @@ function start(init) { if (users.some(function (entry) { return entry.pbkdf2; })) serverconsole.locwarnmessage("PBKDF2 password hashing function in Bun blocks the event loop, which may result in denial of service."); - if (users.some(function (entry) { - return entry.scrypt; - })) serverconsole.locwarnmessage("scrypt password hashing function in Bun blocks the event loop, which may result in denial of service."); } if (cluster.isPrimary === undefined) serverconsole.locwarnmessage("You're running SVR.JS on single thread. Reliability may suffer, as the server is stopped after crash."); if (crypto.__disabled__ !== undefined) serverconsole.locwarnmessage("Your Node.JS version doesn't have crypto support! The 'crypto' module is essential for providing cryptographic functionality in Node.JS. Without crypto support, certain security features may be unavailable, and some functionality may not work as expected. It's recommended to use a Node.JS version that includes crypto support to ensure the security and proper functioning of your server."); diff --git a/svrpasswd.js b/svrpasswd.js index 9a428b6..ef4d241 100644 --- a/svrpasswd.js +++ b/svrpasswd.js @@ -338,7 +338,6 @@ function promptAlgorithms(callback, bypass, pbkdf2, scrypt) { pbkdf2: "PBKDF2 (PBKDF2-HMAC-SHA512, 36250 iterations) - more secure and uses less memory, but slower", scrypt: "scrypt (N=2^14, r=8, p=1) - faster and more secure, but uses more memory" } - if (!crypto.scrypt || process.isBun) delete algorithms.scrypt; if (!crypto.pbkdf2 || process.isBun) delete algorithms.pbkdf2; var algorithmNames = Object.keys(algorithms); if (algorithmNames.length < 2) callback(algorithmNames[0]);