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.
By default, DartArgon2id, our pure Dart implementation, will be used.
Example
import 'package:cryptography/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:cryptography/dart.dart.
- Inheritance
-
- Object
- KdfAlgorithm
- Argon2id
- Implementers
Constructors
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
-
deriveKeyFromPassword(
{required String password, required List< int> nonce}) → Future<SecretKey> -
Generates a new secret key from a
password
and anonce
.inherited -
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