diff --git a/src/pbkdf2.js b/src/pbkdf2.js new file mode 100644 --- /dev/null +++ b/src/pbkdf2.js @@ -0,0 +1,27 @@ +import {int322bytesBE} from "./util.js"; +import {blake2s} from "./blake.js"; + +const HASH_LENGTH=32; + +export function pbkdf2(password,salt,iterationCount,outLength){ + // max BLAKE2 key length is 32B + if(password.length>32){password=blake2s(password);} + + let blockCount=Math.ceil(outLength/HASH_LENGTH); + let result=[]; + + for(let i=0;ib^ui[j]); + } + return u; +}