pub struct KeyImage { /* private fields */ }Expand description
The protocol’s “linking tag” — what the host stores to prevent double voting.
Mathematically: I_e = x · H_p(domain || election_id || x · G),
where x is the secret key, G is the Ristretto255 base point and
H_p is the Ristretto hash-to-group construction. Three properties
matter:
- it is deterministic for a given secret key and election, so casting the same ballot twice in that election yields the same tag;
- it is election-scoped: reusing the same key in a different election yields a different public tag;
- it is anonymous: nothing about it leaks which member of the ring produced it;
- it is unforgeable: the BLSAG proof is only valid if the tag was actually computed from a secret key that matches one of the public keys in the ring.
Encoded as 32 canonical bytes, identical in shape to a public key.
Implementations§
Source§impl KeyImage
impl KeyImage
Sourcepub fn from_bytes(bytes: &[u8; 32]) -> Result<Self>
pub fn from_bytes(bytes: &[u8; 32]) -> Result<Self>
Decode 32 bytes produced by KeyImage::to_bytes.
Sourcepub fn to_prefixed(&self) -> String
pub fn to_prefixed(&self) -> String
Encode in the human-friendly prefixed format: ki_<hex>_<checksum>.
Sourcepub fn from_prefixed(s: &str) -> Result<Self>
pub fn from_prefixed(s: &str) -> Result<Self>
Decode a ki_<hex>_<checksum> string produced by
KeyImage::to_prefixed, verifying the tag and the checksum.
Trait Implementations§
impl Copy for KeyImage
impl Eq for KeyImage
impl StructuralPartialEq for KeyImage
Auto Trait Implementations§
impl Freeze for KeyImage
impl RefUnwindSafe for KeyImage
impl Send for KeyImage
impl Sync for KeyImage
impl Unpin for KeyImage
impl UnsafeUnpin for KeyImage
impl UnwindSafe for KeyImage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more