Skip to content

Commit

Permalink
refine PBKDF2 params
Browse files Browse the repository at this point in the history
  • Loading branch information
imcotton committed Mar 10, 2024
1 parent 0f8d565 commit dc9f933
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ export async function main ([
throw new Error('invalid salt, at least 5 characters long');
}

const entropy = await PBKDF2(encode(salt), encode(passphrase));
const entropy = await PBKDF2({
salt: encode(salt),
passphrase: encode(passphrase),
});

return ssh(new Uint8Array(entropy));

Expand Down
6 changes: 4 additions & 2 deletions src/pbkdf2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import { webcrypto } from './utils.ts';



export async function PBKDF2 (
export async function PBKDF2 (opts: {

salt: BufferSource,
passphrase: BufferSource,

): Promise<ArrayBuffer> {
}): Promise<ArrayBuffer> {

const { salt, passphrase } = opts;

const name = 'PBKDF2';
const byte = 32;
Expand Down

0 comments on commit dc9f933

Please sign in to comment.