Module argon2

Module argon2 

Source
Expand description

Value hashing implementations.

Provides a single configurable Argon2id password hashing service with security‑first defaults.

Build mode defaults:

  • Release builds (debug_assertions disabled): HighSecurity preset
  • Debug builds (debug_assertions enabled): DevFast preset (faster local iteration)

You can override the default explicitly with presets or a custom configuration.

§Example

use axum_gate::hashing::argon2::Argon2Hasher;
use axum_gate::hashing::HashingService;

// Default (build‑mode appropriate) hasher
let hasher = Argon2Hasher::new_recommended().unwrap();
let hash = hasher.hash_value("secret").unwrap();
assert!(hasher.verify_value("secret", &hash).is_ok());

⚠ The DevFast preset MUST NOT be used in production; it exists only to keep debug builds responsive. When you explicitly construct a hasher, choose an appropriate security profile.

Structs§

Argon2Config
Argon2 parameter configuration (memory in KiB).
Argon2Hasher
Configurable Argon2id hasher.

Enums§

Argon2Preset
Preset selector for convenience.