We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Argon2 Phc Review

Let's look at the output string we generate for Argon2id using the PHC format:

$argon2id$v=19$m=65536,t=3,p=2$<saltBase64>$<hashBase64>

This isn't just a hash. It's a self-describing string with:

  • Algorithm: argon2id
  • Version: v=19 (Argon2 spec version 1.3)
  • Parameters:
    • m (memory in KiB): 65536 = 64MiB
    • t (time/iterations): number of passes over memory
    • p (parallelism): threads
  • Salt: base64 (no padding)
  • Hash: base64 (no padding)

Because it embeds the parameters and salt, you can tune settings later and still verify old hashes.

Salt

A salt is a random chunk of data added to a password before it is hashed so that its output hash will differ from the hash of the same password with a different salt. We'll talk about these in more detail soon. Again, we need it to be stored in the output so that we can use it to check the hash later.

Hash

The hash is the Argon2id–derived key: the result of running the password together with the salt and the chosen parameters (m, t, p) through the KDF. In the PHC string it's the final, base64 (no padding) field:

$argon2id$v=19$m=...,t=...,p=...$<saltBase64>$<hashBase64>
                                              ^^^^^^^^^^^

It's not reversible. To verify a password, you recompute the derived key using the stored salt and parameters, then compare the new bytes to the stored hash using a constant-time check.

About M and T

  • m (memory): More KiB means more RAM required per guess, which makes large-scale attacks harder (especially on GPUs and ASICs).
  • t (time/iterations): More passes means more CPU work and a slower hash per guess.