Argon2HashUtil class final
A consolidated utility for handling Argon2id-based secret hashing.
This class provides a unified interface for hashing secrets using the Argon2id algorithm, supporting both String and Uint8List inputs.
Output follows the PHC format: $argon2id$v=19$m={memory},t={iterations},p={lanes}${base64Salt}${base64Hash}
Sample output: $argon2id$v=19$m=65536,t=2,p=1$gZiV/M1gPc22ElAH/Jh1Hw$CWOrkoo7oJBQ/iyh7uJ0LO2aLEfrHwTWllSAxT0zRno
Hashes validated by the class need to follow the PHC format.
Uses the Argon2id algorithm. See: https://en.wikipedia.org/wiki/Argon2
Constructors
-
Argon2HashUtil({required String hashPepper, List<
String> fallbackHashPeppers = const [], required int hashSaltLength, Argon2HashParameters? parameters}) - Creates a new instance of Argon2HashUtil.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createHashFromBytes(
{required Uint8List secret, Uint8List? salt}) → Future< String> -
Create the hash for the given
secret(Uint8List). -
createHashFromString(
{required String secret, Uint8List? salt}) → Future< String> -
Create the hash for the given
secret(String). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
validateHashFromBytes(
{required Uint8List secret, required String hashString}) → Future< bool> -
Verify whether the
hashStringis valid for the givensecret(Uint8List). -
validateHashFromString(
{required String secret, required String hashString}) → Future< bool> -
Verify whether the
hashStringis valid for the givensecret(String).
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited