bytes_from_hex_str!
Encode a hex string literal as static field elements, length first. Bits and bytes
bytes_from_hex_str! "0x..."
Decodes a 0x-prefixed hex string literal into bytes and packs them into field elements: the first element is the number of bytes, followed by the bytes in little-endian chunks of one byte less than the field's byte width (3 bytes per element in the milli field). The encoding is lossless.
Arguments
"0x..."- A string literal starting with
0xfollowed by an even number of hex digits. Variables and other expressions are an error.
Returns
A static vector. It is an expression-form precompile.
Constraints
None.
Example
static v = bytes_from_hex_str! "0x01020304" v
static v = bytes_from_hex_str! "0x123" v
Notes
Bytes 01 02 03 become 0x030201 = 197121, the last byte 04 its own element. Used for the constant in nothing_up_my_sleeve.