oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
71.82k stars 2.55k forks source link

Argon2 option to set / change Hash Length and Parallelism Factor #9074

Open zigazajc007 opened 4 months ago

zigazajc007 commented 4 months ago

What is the problem this feature would solve?

Argon2 in Bun.password.hash function does not allow to change Hash Length and Parallelism Factor.

What is the feature you are proposing to solve the problem?

Expose parallelismFactor and hashLength parameters in Bun.password.hash function

await Bun.password.hash(data.password, {
    algorithm: 'argon2id',
    memoryCost: 64*1024,
    timeCost: 1,
    parallelismFactor: 4,
    hashLength: 32
});

What alternatives have you considered?

No response

zigazajc007 commented 4 months ago

https://www.rfc-editor.org/rfc/rfc9106.html#name-parameter-choice

parallelismFactor 4 is recommended by RFC.