pub trait Encoding<T = [u8]>where
T: ?Sized,{
// Required method
fn encode(&self) -> impl AsRef<T>;
}Expand description
Interface for turning a type into a duplex sponge input.
Encoding<T> defines an encoding into a type T.
By default T = [u8] in order to serve encoding for byte-oriented hash functions.
§Safety
spongefish assumes that prover and verifier will know the length of all the prover messages.
Encoding must be prefix-free: the output of Encoding::encode is never a prefix of any other
instance of the same type.
More information on the theoretical requirements is in [CO25, Theorem 6.2].
§Blanket implementations
§Encoding conventions
For byte sequences, encoding must be the identity function. Integers are encoded via []
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl Encoding for &[u8]
Handy for serializing byte strings.
impl Encoding for &[u8]
Handy for serializing byte strings.
Encoding functions must have size known upon choosing the protocol identifier. While slices don’t have size known at compile time, the burden of making sure that the string is of the correct size is on the caller.
Source§impl Encoding for [u8]
Handy for serializing byte strings.
impl Encoding for [u8]
Handy for serializing byte strings.
§Safety
Encoding functions must have size known upon choosing the protocol identifier. While slices don’t have size known at compile time, the burden of making sure that the string is of the correct size is on the caller.