syn.crypt.custom.hash Synchronous

  • syn.crypto.custom.hash

Compute a digest using one of the Synapse compatibility library’s supported algorithms. Use it to select a digest algorithm while keeping the compatibility calling convention. The algorithm is the first argument here; crypt.hash takes the data first.

Syntax
Luau
syn.crypt.custom.hash(algorithm: string, data: string) -> string

Parameters

Function parameters
ParameterTypeDescription
algorithmstringMD5, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, SHA3-256, SHA3-384, or SHA3-512. Case and common separator variants are normalized.
datastringBytes to hash.

Returns

string

The digest as lowercase hexadecimal text.

Availability

This function requires the Synapse environment setting, which is off by default.

Example

Example
Luau
-- Enable the Synapse environment setting first.
local digest = syn.crypt.custom.hash("SHA256", "example contents")
print(digest)
print(#digest) -- 64 hexadecimal characters
Kawaii documentation