Rust

Unsalted SHA-1, SHA-2 and SHA-3 digests, for imported legacy passwords.

Contents

use utopia_auth::hashes::sha::Sha;
Rust
pub struct Sha

The unsalted SHA digest of a password, as lowercase hex.

Its options hold only version (no type): the name of the algorithm. Weak: use it only to verify passwords imported from another system.

Rust
use utopia_auth::Hash;
use utopia_auth::hashes::{Sha, ShaVersion};

let mut sha = Sha::new();
sha.set_version(ShaVersion::Sha256);
let hash = sha.hash(b"password")?;
assert_eq!(hash, b"5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8");
Also implements Default.
use utopia_auth::hashes::sha::ShaVersion;
Rust
pub enum ShaVersion

A SHA algorithm a Sha hash can use.