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.
Luau
syn.crypt.custom.hash(algorithm: string, data: string) -> stringParameters
| Parameter | Type | Description |
|---|---|---|
algorithm | string | MD5, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, SHA3-256, SHA3-384, or SHA3-512. Case and common separator variants are normalized. |
data | string | Bytes to hash. |
Returns
stringThe digest as lowercase hexadecimal text.
Availability
This function requires the Synapse environment setting, which is off by default.
Example
Luau
-- Enable the Synapse environment setting first.
local digest = syn.crypt.custom.hash("SHA256", "example contents")
print(digest)
print(#digest) -- 64 hexadecimal characters