pub enum Algorithm {
Argon2d = 0,
Argon2i = 1,
Argon2id = 2,
}Expand description
Argon2 primitive type: variants of the algorithm.
Variants§
Argon2d = 0
Optimizes against GPU cracking attacks but vulnerable to side-channels.
Accesses the memory array in a password dependent order, reducing the possibility of time–memory tradeoff (TMTO) attacks.
Argon2i = 1
Optimized to resist side-channel attacks.
Accesses the memory array in a password independent order, increasing the possibility of time-memory tradeoff (TMTO) attacks.
Argon2id = 2
Hybrid that mixes Argon2i and Argon2d passes (default).
Uses the Argon2i approach for the first half pass over memory and Argon2d approach for subsequent passes. This effectively places it in the “middle” between the other two: it doesn’t provide as good TMTO/GPU cracking resistance as Argon2d, nor as good of side-channel resistance as Argon2i, but overall provides the most well-rounded approach to both classes of attacks.
Implementations§
Source§impl Algorithm
impl Algorithm
Sourcepub fn new(id: impl AsRef<str>) -> Result<Self>
pub fn new(id: impl AsRef<str>) -> Result<Self>
Parse an Algorithm from the provided string.
§Errors
Returns Error::AlgorithmInvalid if id is not a valid Argon2 algorithm identifier.
Sourcepub const fn as_str(&self) -> &'static str
pub const fn as_str(&self) -> &'static str
Get the identifier string for this PBKDF2 Algorithm.
Sourcepub(crate) const fn to_le_bytes(self) -> [u8; 4]
pub(crate) const fn to_le_bytes(self) -> [u8; 4]
Serialize primitive type as little endian bytes