Scrypt class
This is an implementation of Password Based Key Derivation Algorithm, scrypt derived from RFC-7914, which internally uses PBKDF2.
The function derives one or more secret keys from a secret string. It is based on memory-hard functions, which offer added protection against attacks using custom hardware.
The strength of the generated password using scrypt depends on the CPU/Memory cost, block size and parallelism parameters. Poor parameter choices can be harmful for security; for example, if you tune the parameters so that memory use is reduced to small amounts that will affect the properties of the algorithm.
- Inheritance
-
- Object
- KeyDerivatorBase
- Scrypt
Constructors
-
Scrypt.new({List<
int> ? salt, required int cost, int blockSize = 8, int parallelism = 1, int derivedKeyLength = 64}) -
Creates an Scrypt instance with a sink for MAC generation.
factory
-
Scrypt.fromSecurity(ScryptSecurity security, {List<
int> ? salt, int derivedKeyLength = 64}) -
Creates an Scrypt instance from ScryptSecurity parameter.
factory
Properties
- blockSize → int
-
Block size parameter (r)
final
- cost → int
-
CPU/Memory cost parameter (N)
final
- derivedKeyLength → int
-
The length of derived key in bytes
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- name → String
-
The name of this algorithm
final
- parallelism → int
-
Parallelization parameter (p)
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
salt
→ List<
int> -
The byte array containing salt
final
Methods
-
convert(
List< int> password) → HashDigest -
Generate a derived key using the scrypt algorithm.
override
-
hex(
List< int> password) → String -
Returns the derived key in hexadecimal.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
string(
String password, [Encoding? encoding]) → HashDigest -
Process the
password
string and returns derived key as HashDigest.inherited -
toString(
) → String -
A string representation of this object.
inherited
-
verify(
List< int> derivedKey, List<int> password) → bool -
Verify if the
derivedKey
was derived from the originalpassword
using the current parameters.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited