syn. crypt. derive Synchronous
syn.crypto.derive
Derive a fixed-length byte string from input material with Kawaii’s HKDF-SHA-256 scheme. This is useful when one input secret must be turned into a reproducible byte sequence of a specific length.
Luau
syn.crypt.derive(value: string, length: number) -> stringParameters
| Parameter | Type | Description |
|---|---|---|
value | string | Raw input key material. |
length | number | Requested number of output bytes, an integer from 0 through 8160. |
Returns
stringRaw derived bytes. The same input and length produce the same output in this implementation.
Usage notes
The derived bytes are binary, not Base64 text. Use base64encode when storing them in a text-only format.
Availability
This function requires the Synapse environment setting, which is off by default.
Example
Luau
local bytes = syn.crypt.derive("example seed", 32)
print(#bytes) -- 32
print(base64encode(bytes))