native_crypt function

Pointer<Utf8> native_crypt(
  1. Pointer<Utf8> key,
  2. Pointer<Utf8> salt
)

One-way hash PHRASE, returning a string suitable for storage in the user database. SALT selects the one-way function to use, and ensures that no two users' hashes are the same, even if they use the same passphrase. The return value points to static storage which will be overwritten by the next call to crypt.

Implementation

ffi.Pointer<Utf8> native_crypt(
  ffi.Pointer<Utf8> key,
  ffi.Pointer<Utf8> salt,
) {
  _crypt ??= Libc().dylib.lookupFunction<
      ffi.Pointer<Utf8> Function(ffi.Pointer<Utf8>, ffi.Pointer<Utf8>),
      _dart_crypt>('crypt');
  return _crypt!(
    key,
    salt,
  );
}