deriveKey method

  1. @override
int deriveKey(
  1. Uint8List inp,
  2. int inpOff,
  3. Uint8List out,
  4. int outOff,
)
override

Derive key from given input and put it in out at offset outOff.

Implementation

@override
int deriveKey(Uint8List inp, int inpOff, Uint8List out, int outOff) {
  inp = inp.sublist(inpOff);
  var outLen = parameters.desiredKeyLength;

  if (outLen < MIN_OUTLEN) {
    throw ArgumentError.value(
        outLen, 'outLen', 'output length less than $MIN_OUTLEN');
  }

  var tmpBlockBytes = Uint8List(ARGON2_BLOCK_SIZE);

  _initialize(tmpBlockBytes, inp, outLen);
  _fillMemoryBlocks();
  _digest(tmpBlockBytes, out, outOff, outLen);

  _reset();

  return outLen;
}