syn. crypt. derive Synchronous
syn.crypto.derive
Derive a byte string from input material using the compatibility library’s HKDF-SHA-256 derivation. Use it to expand existing key material into a reproducible byte sequence. Derivation is not random generation and does not turn a weak password into a strong secret.
Luau
syn.crypt.derive(value: string, length: number) -> stringParameters
| Parameter | Type | Description |
|---|---|---|
value | string | Input key material. |
length | number | Requested output length in bytes, as an integer from 0 through 8160. |
Returns
stringRaw derived bytes. Identical input and length produce the same output.
Availability
This function requires the Synapse environment setting, which is off by default.
Example
Luau
-- Enable the Synapse environment setting first.
local material = syn.crypt.random(32)
local derived = syn.crypt.derive(material, 32)
print(#derived) -- 32
print(derived == syn.crypt.derive(material, 32)) -- true