shieldhash library

Constants

defaultRounds → const int
Default rounds if none provided (12 => 4096 iterations).
dkLength → const int
Derived key length in bytes (recommend 32 for SHA256).
maxRounds → const int
Maximum allowed rounds to avoid extreme CPU time.
minRounds → const int
Minimum allowed rounds.
saltLength → const int
Salt length in bytes.

Functions

compare(String password, String stored) → bool
Verify a password against a stored hash string produced by hash. Returns true if password matches, false otherwise. Comparison is time-constant.
genSalt({int rounds = defaultRounds}) → String
Generate a salt string encoding the rounds and salt bytes. This returns just the base64 salt, not the full formatted hash.
hash(String password, {int rounds = defaultRounds}) → String
Hash a plaintext password and return formatted string: $shield$