Skip to main content

Module hashing

Module hashing 

Source
Expand description

Password hashing and verification APIs.

This module contains the hashing-facing API of webgates-secrets.

It provides the hashing abstraction, the default Argon2id implementation, and the HashedValue type used for stored hashes.

§Key types

§Examples

use webgates_core::verification_result::VerificationResult;
use webgates_secrets::hashing::argon2::Argon2Hasher;
use webgates_secrets::hashing::hashing_service::HashingService;

let hasher = Argon2Hasher::new_recommended().unwrap();

// Hash a password
let hashed = hasher.hash_value("user_password").unwrap();
println!("Hashed password: {}", hashed);

// Verify a password
let result = hasher.verify_value("user_password", &hashed).unwrap();
assert_eq!(result, VerificationResult::Ok);

§Canonical Public Paths

Each public item in this module has a single canonical path through its owning submodule:

§Security notes

  • Argon2id algorithm - Recommended by password hashing competition
  • Configurable parameters - Memory cost, time cost, and parallelism
  • Built-in salt generation - Each password gets a unique random salt
  • Constant-time verification - Prevents timing attacks
  • Development vs production profiles - Fast hashing in debug builds, secure in release

§Usage notes

The hashing service automatically adjusts parameters based on build configuration:

  • Debug builds: Fast parameters for development efficiency
  • Release builds: Secure parameters for production security
  • Custom parameters: Override via Argon2Hasher::from_config()

Modules§

argon2
Argon2id hashing implementation.
errors
Error types for hashing and verification.
hashing_service
Hashing service traits and public contracts.

Type Aliases§

HashedValue
Stored hash string produced by a hashing algorithm.