Skip to content

Commit d397703

Browse files
feat(argon2): raise default memory cost to OWASP minimum (19 MiB) (#420)
Raise the default Argon2id memory cost from 4 MiB to 19 MiB to match the OWASP minimum (m=19 MiB, t=2, p=1). Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 8aae105 commit d397703

6 files changed

Lines changed: 21 additions & 13 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
66

77
## [Unreleased] -
88

9+
### Breaking Changes
10+
11+
- The default Argon2id parameters (`Argon2Parameters::default()`, `Argon2::new()`, `derive_key` / `encrypt_with_password` with `Latest`) now use 19 MiB of memory (19456 KiB) instead of 4 MiB, matching the OWASP Password Storage Cheat Sheet minimum (m=19 MiB, t=2, p=1). Existing data is unaffected: the parameters are serialized alongside every derivation and are read back from there. Callers that rebuild parameters from the defaults instead of persisting the serialized `Argon2Parameters` / `DerivationParameters` must pin `memory = 4096` to keep deriving the same keys.
12+
913
## [0.10.2] - 2026-09-14
1014

1115
- Fix a double free in the C# wrapper

‎python/CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
66

77
## [Unreleased]
88

9+
### Breaking changes
10+
11+
- The default Argon2id parameters now use 19 MiB of memory (19456 KiB) instead of 4 MiB, matching the OWASP minimum. Existing data is unaffected since the parameters are serialized with each derivation.
12+
913
## [2026.6.16] - 2026-06-16
1014

1115
### Breaking changes

‎src/argon2parameters.rs‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub mod defaults {
2323

2424
pub const LENGTH: u32 = 32;
2525
pub const LANES: u32 = 1;
26-
pub const MEMORY: u32 = 4096;
26+
pub const MEMORY: u32 = 19456;
2727
pub const ITERATIONS: u32 = 2;
2828
pub const VARIANT: Variant = Variant::Argon2id;
2929
pub const VERSION: Version = Version::Version13;
@@ -105,13 +105,13 @@ impl Default for Argon2Parameters {
105105
Argon2Parameters {
106106
associated_data: Vec::new(),
107107
secret_key: Vec::new(),
108-
length: 32,
109-
lanes: 1,
110-
memory: 4096,
111-
iterations: 2,
112-
variant: Variant::Argon2id,
113-
version: Version::Version13,
114-
dc_version: 1,
108+
length: defaults::LENGTH,
109+
lanes: defaults::LANES,
110+
memory: defaults::MEMORY,
111+
iterations: defaults::ITERATIONS,
112+
variant: defaults::VARIANT,
113+
version: defaults::VERSION,
114+
dc_version: defaults::DC_VERSION,
115115
salt,
116116
}
117117
}

‎wrappers/csharp/tests/unit-tests/TestManaged.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ public void GetDefaultArgon2ParametersSizeNative_Default()
349349
Argon2Parameters defaultArgon2Parameters = Managed.GetDefaultArgon2Parameters();
350350

351351
Assert.IsTrue(defaultArgon2Parameters != null);
352-
Assert.IsTrue(defaultArgon2Parameters.Memory == 4096);
352+
Assert.IsTrue(defaultArgon2Parameters.Memory == 19456);
353353
}
354354

355355
[TestMethod]

‎wrappers/wasm/demo/src/app/derive-encrypt/derive-encrypt.component.html‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ <h1>Derive and Encrypt</h1>
7979
<details style="border:1px solid #ddd;border-radius:6px;padding:0.75rem 1rem;margin:0.5rem 0 0.75rem;">
8080
<summary style="font-size:0.85rem;color:#666;cursor:pointer;user-select:none;">Argon2 Parameters (optional)</summary>
8181
<div class="field">
82-
<label>Memory (KiB) <span style="font-weight:normal;color:#888;">— default: 4096</span></label>
83-
<input type="number" formControlName="argon2Memory" min="8" placeholder="e.g. 4096">
82+
<label>Memory (KiB) <span style="font-weight:normal;color:#888;">— default: 19456</span></label>
83+
<input type="number" formControlName="argon2Memory" min="8" placeholder="e.g. 19456">
8484
</div>
8585
<div class="field">
8686
<label>Iterations <span style="font-weight:normal;color:#888;">— default: 2</span></label>

‎wrappers/wasm/demo/src/app/key-derivation/key-derivation.component.html‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ <h1>Key Derivation</h1>
4444
<!-- Argon2 parameters -->
4545
@if (algorithm === 'argon2') {
4646
<div class="field">
47-
<label>Memory (KiB) <span style="font-weight:normal;color:#888;">— default: 4096</span></label>
48-
<input type="number" formControlName="argon2Memory" min="8" placeholder="e.g. 4096">
47+
<label>Memory (KiB) <span style="font-weight:normal;color:#888;">— default: 19456</span></label>
48+
<input type="number" formControlName="argon2Memory" min="8" placeholder="e.g. 19456">
4949
</div>
5050
<div class="field">
5151
<label>Iterations <span style="font-weight:normal;color:#888;">— default: 2</span></label>

0 commit comments

Comments
 (0)