#[derive(Encoding)]
{
// Attributes available to this derive:
#[spongefish]
}
Expand description
Derive Encoding for structs.
Fields marked with #[spongefish(skip)] are omitted from the encoding.
Any other #[spongefish(..)] form is a compile error.
ยงSecurity
Skip only values that are recomputable, or genuinely irrelevant to the statement being proven.
A skipped field is not bound by the Fiat-Shamir transformation, and therefore is never part of the inputs to the random oracle, nor of the NARG string.
use spongefish::Encoding;
#[derive(Encoding)]
struct Rgb {
r: u8,
g: u8,
b: u8,
}
let colors = Rgb { r: 1, g: 2, b: 3 };
let data = colors.encode();
assert_eq!(data.as_ref(), [1, 2, 3]);