Module serialization

Module serialization 

Source
Expand description

Serialization utilities for witness and proof data

Handles conversion between JavaScript types and Arkworks field elements. All byte arrays use Little-Endian format (as expected by Arkworks).

Functionsยง

bytes_to_fr
Convert Little-Endian bytes to Arkworks Fr field element
bytes_to_scalar
Convert Little-Endian bytes to zkhash Scalar
decimal_to_field_bytes
Convert a decimal string to Little-Endian field element bytes
field_bytes_to_hex
Convert Little-Endian field bytes to hex string
fr_to_bytes
Convert Arkworks Fr field element to Little-Endian bytes
hex_to_field_bytes
Convert hex string to Little-Endian field bytes
hex_to_scalar
Convert hex string to zkhash Scalar
parse_witness
Parse witness bytes into vector of Fr elements
scalar_to_bytes
Convert zkhash Scalar to Little-Endian bytes
scalar_to_hex
Convert zkhash Scalar to hex string (for JS BigInt)
u64_to_field_bytes
Convert a u64 to Little-Endian field element bytes
witness_element_count
Get the number of witness elements