fix: salt should not be random #1052

see #1052 
this causes hash tables to fail, because a different hash will be generated for content every time.
in case incomming salt is null, it will be set to always be the empty string
This commit is contained in:
sirpy 2021-02-18 10:07:20 +02:00 committed by GitHub
parent 4ded14186f
commit 9363ffddeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

2
sea.js
View File

@ -278,7 +278,7 @@
if(cb){ try{ cb(rsha) }catch(e){console.log(e)} } if(cb){ try{ cb(rsha) }catch(e){console.log(e)} }
return rsha; return rsha;
} }
salt = salt || shim.random(9); salt = salt || '';
var key = await (shim.ossl || shim.subtle).importKey('raw', new shim.TextEncoder().encode(data), {name: opt.name || 'PBKDF2'}, false, ['deriveBits']); 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({ var work = await (shim.ossl || shim.subtle).deriveBits({
name: opt.name || 'PBKDF2', name: opt.name || 'PBKDF2',