Argon2id class abstract
Argon2id (draft-irtf-cfrg-argon2-03) password hashing function.
Argon2 is known for winning Password Hashing Competition 2015. The algorithm can provide much better security than older algorithms such as Pbkdf2.
Example
import 'package:better_cryptography/better_cryptography.dart';
Future<void> main() async {
final algorithm = Argon2id(
parallelism: 3,
memorySize: 10000000,
iterations: 3,
hashLength: 32,
);
final newSecretKey = await algorithm.deriveKey(
secretKey: SecretKey([1,2,3]),
nonce: [4,5,6],
);
final newSecretKeyBytes = await newSecretKey.extractBytes();
print('hashed password: $newSecretKeyBytes');
}
In need of synchronous APIs?
If you need to perform operations synchronously, use DartArgon2id in package:better_cryptography/dart.dart.
- Inheritance
-
- Object
- KdfAlgorithm
- Argon2id
- Implementers
Constructors
- Argon2id.new({required int parallelism, required int memorySize, required int iterations, required int hashLength})
-
factory
- Argon2id.constructor()
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- hashLength → int
-
Hash length.
no setter
- iterations → int
-
Number of iterations.
no setter
- memorySize → int
-
Minimum number of bytes attacker needs to store in memory for each
attempt.
no setter
- parallelism → int
-
Maximum number of processors attacker can use concurrently for each
attempt.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- version → int
-
Argon2id algorithm version number.
no setter
Methods
-
deriveKey(
{required SecretKey secretKey, required List< int> nonce, List<int> k = const <int>[], List<int> ad = const <int>[]}) → Future<SecretKey> -
Calculates output of Argon2id algorithm.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override