init method

  1. @override
void init(
  1. covariant Argon2Parameters parameters
)
override

Initialise the Argon2BytesGenerator from the parameters.

  • param parameters Argon2 configuration.

Implementation

@override
void init(covariant Argon2Parameters parameters) {
  _parameters = parameters;

  if (parameters.lanes < MIN_PARALLELISM) {
    throw ArgumentError.value(parameters.lanes, 'parameters.lanes',
        'lanes must be greater than $MIN_PARALLELISM');
  } else if (parameters.lanes > MAX_PARALLELISM) {
    throw ArgumentError.value(parameters.lanes, 'parameters.lanes',
        'lanes must be less than $MAX_PARALLELISM');
  } else if (parameters.memory < 2 * parameters.lanes) {
    throw ArgumentError.value(parameters.memory, 'parameters.memory',
        'memory is less than: ${2 * parameters.lanes} expected ${2 * parameters.lanes}');
  } else if (parameters.iterations < MIN_ITERATIONS) {
    throw ArgumentError.value(parameters.iterations, 'parameters.iterations',
        'iterations is less than: $MIN_ITERATIONS');
  }

  _doInit(parameters);
}