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.
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. |
data | string | Bytes to hash. |
Returns
stringThe 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
Luau
local sha256 = syn.crypt.custom.hash("sha-256", "profile-v2")
print(sha256)
assert(sha256 == syn.crypt.custom.hash("SHA256", "profile-v2"))