public static byte[] ScryptHashLowLevel(byte[] password, byte[] salt, long N, int R, int P, uint bufferLength = SCRYPT_SALSA208_SHA256_STRBYTES) { var buffer = new byte[bufferLength]; SodiumCore.Init(); var ret = SodiumLibrary.crypto_pwhash_scryptsalsa208sha256_ll(password, password.Length, salt, salt.Length, N, R, P, buffer, buffer.Length); if (ret != 0) { throw new OutOfMemoryException("Internal error, hash failed (usually because the operating system refused to allocate the amount of requested memory)."); } return(buffer); }