syn.crypt.custom.hash Synchronous

  • syn.crypto.custom.hash

Compute a digest using the algorithm named by the caller. This is useful when a file format or another system already specifies which hash to use.

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.
datastringBytes to hash.

Returns

string

The digest as lowercase hexadecimal text.

Usage notes

Algorithm names accept common case and separator variants. A plain hash is a fingerprint, not an authentication code.

Availability

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

Example

Example
Luau
local sha256 = syn.crypt.custom.hash("sha-256", "profile-v2")
print(sha256)
assert(sha256 == syn.crypt.custom.hash("SHA256", "profile-v2"))
Kawaii documentation