crypt.hash

Computes a hash digest.

Syntax

Signature
crypt.hash(Data: string, Algorithm: string?) -> string

Aliases

This function has no aliases.

Parameters

ParameterTypeDescription
DatastringBytes to hash, up to 16 MiB.
Algorithmstring?Hash algorithm. Defaults to sha256.

Returns

TypeDescription
stringLowercase hexadecimal digest.

Notes

Algorithm defaults to sha256. Supported names are md5, sha1, sha256, sha384, sha512, sha3-256, sha3-384, and sha3-512. The platform provider can reject an unavailable algorithm.

Example

Luau
local Result = crypt.hash("hello")
print(Result)