fix: convert numeric salt to string in PBKDF2 implementation

This commit is contained in:
x 2025-03-07 11:50:07 +07:00
parent 38f7006d89
commit b9a6b274f3
2 changed files with 2 additions and 0 deletions

1
sea.js
View File

@ -297,6 +297,7 @@
if(cb){ try{ cb(rsha) }catch(e){console.log(e)} }
return rsha;
}
if (typeof salt === "number") salt = salt.toString();
salt = salt || shim.random(9);
var key = await (shim.ossl || shim.subtle).importKey('raw', new shim.TextEncoder().encode(data), {name: opt.name || 'PBKDF2'}, false, ['deriveBits']);
var work = await (shim.ossl || shim.subtle).deriveBits({

View File

@ -23,6 +23,7 @@
if(cb){ try{ cb(rsha) }catch(e){console.log(e)} }
return rsha;
}
if (typeof salt === "number") salt = salt.toString();
salt = salt || shim.random(9);
var key = await (shim.ossl || shim.subtle).importKey('raw', new shim.TextEncoder().encode(data), {name: opt.name || 'PBKDF2'}, false, ['deriveBits']);
var work = await (shim.ossl || shim.subtle).deriveBits({