Skip to content

Fix Argon2 PHC parameter order - #562

Merged
ranisalt merged 3 commits into
ranisalt:masterfrom
sean0407:codex/fix-phc-argon2-param-order-559
Oct 17, 2026
Merged

ranisalt merged 3 commits into
ranisalt:masterfrom
sean0407:codex/fix-phc-argon2-param-order-559

Conversation

@sean0407

Copy link
Copy Markdown
Contributor

Summary

hash() builds Argon2 parameters as { m, t, p }. The PHC formatter serializes parameter keys in insertion order, so generated hashes now follow the Argon2 m,t,p sequence.

- { m, p, t }
+ { m, t, p }

Evidence

  • Before: Issue #559 reports output with m=65536,p=4,t=3; the PHC string specification requires m,t,p.
  • After: Exact-output fixtures use m=65536,t=3,p=4 for the supported hash variants, including the optional data parameter. Static inspection confirms the formatter preserves the parameter object's key order.

Merge Danger

Door: Two-way

Existing hashes remain accepted by the parser; the digest and salt are unchanged.

Blast Radius: Narrow

Only the serialized parameter order changes.

Comment thread argon2.cjs Outdated
@ranisalt

ranisalt commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

You will also need to rebase from master because one-var is pointless but enabled by default; I just disabled it on master.

I can do it easily if you prefer

Edit: doing it myself to bump the version faster

@ranisalt
ranisalt force-pushed the codex/fix-phc-argon2-param-order-559 branch from dea7631 to aed30e4 Compare October 17, 2026 19:31
@ranisalt
ranisalt merged commit d6d2275 into ranisalt:master Oct 17, 2026
29 of 34 checks passed
@ranisalt

Copy link
Copy Markdown
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants