deriveKeyBytesFromPrehashingDigest method

  1. @visibleForTesting
Future<List<int>> deriveKeyBytesFromPrehashingDigest(
  1. Uint8List h0
)

Implementation

@visibleForTesting
Future<List<int>> deriveKeyBytesFromPrehashingDigest(Uint8List h0) async {
  final futureOfPreviousComputation = _futureOfLastScheduledComputation;
  final completer = Completer();
  final future = completer.future;
  _futureOfLastScheduledComputation = future;
  if (futureOfPreviousComputation != null) {
    await futureOfPreviousComputation;
  }

  getByteBuffer();
  _isBufferUsed = true;
  try {
    // Initialize blocks.
    initialize(h0: h0);

    // Compute lanes after N iterations.
    await iterate();

    // Constructs the output.
    final result = _getOutput();

    return result;
  } finally {
    _isBufferUsed = false;

    // If this is the last scheduled computation,
    // clear the variable.
    if (identical(_futureOfLastScheduledComputation, future)) {
      _futureOfLastScheduledComputation = null;
    }

    // If someone is waiting for the state,
    // signal that it's ready for use.
    completer.complete();
  }
}