hashStorage static method

String hashStorage(
  1. Uint8List password, {
  2. int? opslimit,
  3. int? memlimit,
})

Computes a password verification string for given password.

Implementation

static String hashStorage(Uint8List password,
    {int? opslimit, int? memlimit}) {
  opslimit ??= Sodium.cryptoPwhashOpslimitInteractive;
  memlimit ??= Sodium.cryptoPwhashMemlimitInteractive;

  final str = Sodium.cryptoPwhashStr(password, opslimit, memlimit);
  // ascii decode null-terminated string
  return ascii.decode(str.takeWhile((c) => c != 0).toList());
}