stringToBytes32
stringToBytes32(
str):Uint8Array
Defined in: src/Hash.ts:63
Convert a string to a 32-byte array.
Encodes the string as UTF-8, pads with zeros if shorter than 32 bytes, and truncates if longer (with a console warning).
Parameters
str
string
The string to convert
Returns
Uint8Array
A 32-byte Uint8Array
Example
const bytes = Midday.Hash.stringToBytes32('my-password');// Use in witness function or pass to bytes32()Since
0.3.0