pub struct Signature { /* private fields */ }Expand description
A ring signature produced by crate::sign_vote.
The on-the-wire encoding is:
challenge : 32 bytes (canonical Scalar little-endian)
responses[0] : 32 bytes
responses[1] : 32 bytes
...
responses[n-1] : 32 byteswhere n is the size of the authorised ring. The ring members
themselves are not stored inside the signature: the verifier is
expected to already know the canonical authorised list, and to
reconstruct the ring from it in the same deterministic order used at
signing time. That way the signer cannot ship a hand-picked ring of
their own.
Implementations§
Source§impl Signature
impl Signature
Sourcepub fn from_bytes(bytes: &[u8], ring_size: usize) -> Result<Self>
pub fn from_bytes(bytes: &[u8], ring_size: usize) -> Result<Self>
Deserialise from the byte layout described in the struct docs.
ring_size must be the size of the authorised list the verifier
is about to check against. We require it explicitly because the
signature on its own cannot tell n scalars from n+1.
Sourcepub fn from_hex(s: &str, ring_size: usize) -> Result<Self>
pub fn from_hex(s: &str, ring_size: usize) -> Result<Self>
Decode from a hex string. See Signature::from_bytes for the
meaning of ring_size.
Sourcepub fn to_prefixed(&self) -> String
pub fn to_prefixed(&self) -> String
Encode in the human-friendly prefixed format:
blsag_<hex>_<checksum>. The body length grows with the ring, but
the format is otherwise identical to the fixed-size types.
Sourcepub fn from_prefixed(s: &str, ring_size: usize) -> Result<Self>
pub fn from_prefixed(s: &str, ring_size: usize) -> Result<Self>
Decode a blsag_<hex>_<checksum> string produced by
Signature::to_prefixed, verifying the tag and the checksum. See
Signature::from_bytes for the meaning of ring_size.