Import std.crypto.passwords
Argon2id
struct
Public Struct Argon2id
Argon2id (RFC 9106), a hash that takes memory as well as time.
Examples
Local kept = Argon2id.Hash("correct horse")
Expect(kept.StartsWith("$argon2id$v=19$"))
Expect(Argon2id.Verify("correct horse", kept))
Expect(!Argon2id.Verify("wrong horse", kept))std/crypto/passwords.fb, line 34
-
The PHC string of
password's hash, "$argon2id$v=19$m=19456,t=2,p=1$$", with a new 16-byte salt and OWASP's parameters: 19 MiB of memory, 2 passes, and 1 lane. -
@PanicsAtCaller Public Static Method Hash(password: String, memory: Int, iterations: Int, parallelism: Int): Stringstatic method #The same, with
memoryKiB,iterationspasses, andparallelismlanes. Panics unlessparallelismis from 1 to 16777215,memoryis at least 8 timesparallelism, anditerationsis 1 or more. -
Whether
passwordis the one hash, a PHC string from Hash, was made from. A hash that isn't an Argon2id PHC string is no password's. -
@PanicsAtCaller Public Static Method Derive(password: UInt8[], salt: UInt8[], memory: Int, iterations: Int, parallelism: Int, length: Int, secret: UInt8[] = [], associated: UInt8[] = []): UInt8[]static method #lengthbytes of key frompasswordandsalt, with those costs, and withsecret, a key that isn't kept with the hash, andassociateddata, which can both be empty. Panics as Hash does, or unlesssaltis 8 bytes or more andlength4 or more.
Report an issue with this page or with FutureBlitz on GitHub.