Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

argon2: fix checks for parallelism and iterations parameters #69

Merged
merged 1 commit into from
Jul 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/argon2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ function argon2Init(type: Types, password: Input, salt: Input, opts: ArgonOpts)
assertNumber(t);
assertNumber(version);
if (dkLen < 4 || dkLen >= 2 ** 32) throw new Error('Argon2: dkLen should be at least 4 bytes');
if (dkLen < 1 || p >= 2 ** 32) throw new Error('Argon2: p (paralllelism) should be at least 1');
if (dkLen < 1 || p >= 2 ** 32) throw new Error('Argon2: t (iterations) should be at least 1');
if (p < 1 || p >= 2 ** 32) throw new Error('Argon2: p (parallelism) should be at least 1');
if (t < 1 || t >= 2 ** 32) throw new Error('Argon2: t (iterations) should be at least 1');
if (m < 8 * p) throw new Error(`Argon2: memory should be at least 8*p bytes`);
if (version !== 16 && version !== 19) throw new Error(`Argon2: unknown version=${version}`);
password = toBytes(password);
Expand Down