cryptoPwhashStrVerify static method

int cryptoPwhashStrVerify(
  1. Uint8List str,
  2. Uint8List passwd
)

Implementation

static int cryptoPwhashStrVerify(Uint8List str, Uint8List passwd) {
  RangeError.checkValueInInterval(
      str.length, 1, cryptoPwhashStrbytes, 'str', 'Invalid length');
  RangeError.checkValueInInterval(passwd.length, cryptoPwhashPasswdMin,
      cryptoPwhashPasswdMax, 'passwd', 'Invalid length');

  // make sure str is null terminated
  final _str =
      str.toNullTerminatedList(maxLength: cryptoPwhashStrbytes).toPointer();
  final _passwd = passwd.toPointer();
  try {
    return _cryptoPwhash.crypto_pwhash_str_verify(
        _str, _passwd, passwd.length);
  } finally {
    calloc.free(_passwd);
    calloc.free(_str);
  }
}