crypto.argon2
Constants #
const version = u32(0x13)
const default_time = u32(3)
const default_memory = u32(64 * 1024)
const default_threads = u8(4)
const default_key_len = u32(32)
const default_salt_len = 16
fn compare_hash_and_password #
fn compare_hash_and_password(password []u8, encoded_hash []u8) !
compare_hash_and_password verifies a PHC-formatted Argon2 hash against password.
fn d_key #
fn d_key(password []u8, salt []u8, time u32, memory u32, threads u8, key_len u32) ![]u8
d_key derives a key from password and salt using Argon2d.
fn default_params #
fn default_params() Params
default_params returns the recommended default Argon2id password hashing parameters.
fn generate_from_password #
fn generate_from_password(password []u8) !string
generate_from_password hashes password with default Argon2id parameters and returns a PHC-formatted encoded string.
fn generate_from_password_with_params #
fn generate_from_password_with_params(password []u8, params Params) !string
generate_from_password_with_params hashes password with Argon2id using params and returns a PHC-formatted encoded string.
fn id_key #
fn id_key(password []u8, salt []u8, time u32, memory u32, threads u8, key_len u32) ![]u8
id_key derives a key from password and salt using Argon2id.
fn key #
fn key(password []u8, salt []u8, time u32, memory u32, threads u8, key_len u32) ![]u8
key derives a key from password and salt using Argon2i.
struct Params #
struct Params {
pub:
time u32
memory u32
threads u8
key_len u32
salt_len int
}
Params controls Argon2 password hashing output.