PasswordHash
A password's hash (crypto.hash_password): the PHC string of Argon2id, $argon2id$v=19$m=19456,t=2,p=1$<salt>$<hash>, which a sign-in checks a password against.
A password's hash (crypto.hash_password): the PHC string of Argon2id, $argon2id$v=19$m=19456,t=2,p=1$<salt>$<hash>, which a sign-in checks a password against.
Security; not ordered; since Jadpo 0.1.0.
Make one
Build one from its text, PasswordHash("$argon2id$v=19$m=19456,t=2,p=1$AAECAwQFBgcICQoLDA0ODw$gYJZtjEAJqjg26xdLmknq8/bB7MiWPrE9hsYuA+SkIU"), which checks it: text that isn't one breaks format.
text.parse(raw, as: PasswordHash) reads one from its text; text that isn't one at all fails malformed, such as correct horse battery staple.
This operation gives one: crypto.hash_password.
Text, JSON and storage
text.from writes its canonical text, the one form text.parse reads back. JSON sends its canonical text as a string.
| Text | JSON |
|---|---|
$argon2id$v=19$m=19456,t=2,p=1$AAECAwQFBgcICQoLDA0ODw$gYJZtjEAJqjg26xdLmknq8/bB7MiWPrE9hsYuA+SkIU |
"$argon2id$v=19$m=19456,t=2,p=1$AAECAwQFBgcICQoLDA0ODw$gYJZtjEAJqjg26xdLmknq8/bB7MiWPrE9hsYuA+SkIU" |
$argon2id$v=19$m=4096,t=3,p=1$AAECAwQFBgcICQoLDA0ODw$VTsSHiMxkq48zEo8LUSymjr7JjaRSgsxGX2Z8HQE9Cw |
"$argon2id$v=19$m=4096,t=3,p=1$AAECAwQFBgcICQoLDA0ODw$VTsSHiMxkq48zEo8LUSymjr7JjaRSgsxGX2Z8HQE9Cw" |
It is stored in one column named for the field, of type text. $argon2id$v=19$m=4096,t=3,p=1$AAECAwQFBgcICQoLDA0ODw$VTsSHiMxkq48zEo8LUSymjr7JjaRSgsxGX2Z8HQE9Cw is stored as '$argon2id$v=19$m=4096,t=3,p=1$AAECAwQFBgcICQoLDA0ODw$VTsSHiMxkq48zEo8LUSymjr7JjaRSgsxGX2Z8HQE9Cw'.
Shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
$argon2id$v=19$m=19456,t=2,p=1$AAECAwQFBgcICQoLDA0ODw$gYJZtjEAJqjg26xdLmknq8/bB7MiWPrE9hsYuA+SkIU |
$argon2id$v=19$m=19456,t=2,p=1$AAECAwQFBgcICQoLDA0ODw$gYJZtjEAJqjg26xdLmknq8/bB7MiWPrE9hsYuA+SkIU |
$argon2id$v=19$m=4096,t=3,p=1$AAECAwQFBgcICQoLDA0ODw$VTsSHiMxkq48zEo8LUSymjr7JjaRSgsxGX2Z8HQE9Cw |
$argon2id$v=19$m=4096,t=3,p=1$AAECAwQFBgcICQoLDA0ODw$VTsSHiMxkq48zEo8LUSymjr7JjaRSgsxGX2Z8HQE9Cw |
Operations
crypto.hash_password(password: Password) -> PasswordHash: The password's Argon2id hash at the release's parameters (19 MiB, 2 passes, 1 lane), as a PHC string, with a fresh random salt.crypto.verify_password(password: Password, hash: PasswordHash) -> PasswordCheck:correct,wrong, orcorrect_outdatedwhen the hash was made with older parameters and a fresh one should be stored; compared in constant time.
Like every standard type, it also has the contract's own operations: text.parse, text.from, text.format, json.read, json.write and ==. It isn't ordered, so < and sorting don't take it. Every standard type meets one contract says how they work.
Markdown for agents: /docs/types/type-password-hash.md.Built from Jadpo main at e00e61f.