reduce extreme time consumption of pbkdf
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Timo Hocker 2023-04-04 22:09:25 +02:00
parent 78a535087a
commit 5bbf9d658c
Signed by: Timo
GPG Key ID: DFAC2CF4E1D1BEC9
3 changed files with 3 additions and 3 deletions

View File

@ -12,7 +12,7 @@ const { scrypt } = require ('scrypt-js');
async function pbkdf_scrypt (str, salt) { async function pbkdf_scrypt (str, salt) {
const bstr = Buffer.from (str.normalize ('NFKC'), 'utf-8'); const bstr = Buffer.from (str.normalize ('NFKC'), 'utf-8');
const bsalt = Buffer.from (salt.normalize ('NFKC'), 'utf-8'); const bsalt = Buffer.from (salt.normalize ('NFKC'), 'utf-8');
const hash = await scrypt (bstr, bsalt, 65536, 8, 1, 64); const hash = await scrypt (bstr, bsalt, 8192, 8, 1, 64);
return Buffer.from (hash) return Buffer.from (hash)
.toString ('hex'); .toString ('hex');
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@sapphirecode/crypto-helper", "name": "@sapphirecode/crypto-helper",
"version": "2.1.0", "version": "2.1.1",
"main": "index.js", "main": "index.js",
"author": { "author": {
"name": "Timo Hocker", "name": "Timo Hocker",

View File

@ -10,7 +10,7 @@ describe ('hashing', () => {
) )
.toEqual ( .toEqual (
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
'1c357645d521cce3d015441a4215814d8acbf98ed671880ba369039784de05043f0fd9867a0f265b6e5303da202ec4d541bd11752079d8f490ed1fc52e547497' 'f70baff6e80e83a2fc5af752f4b57b6b73442f913fc6446b6cb62e3f5f56f9b18c51c3461081239fdac6e9f8498a95ecfabb0b927db8a9ee2de80ed40469b034'
); );
}); });
}); });