Skip to main content

IndexedSigCode

Enum IndexedSigCode 

Source
pub enum IndexedSigCode {
Show 16 variants Ed25519, Ed25519Crt, ECDSA256k1, ECDSA256k1Crt, ECDSA256r1, ECDSA256r1Crt, Ed448, Ed448Crt, Ed25519Big, Ed25519BigCrt, ECDSA256k1Big, ECDSA256k1BigCrt, ECDSA256r1Big, ECDSA256r1BigCrt, Ed448Big, Ed448BigCrt,
}
Available on crate feature core only.
Expand description

The 16 CESR indexed signature codes.

Each variant maps to a fixed CESR hard code string, a sizage table entry, and metadata about its index mode, raw size, and capacity.

“Crt” (current-only) variants carry only the signer’s index in the current key list. Non-Crt variants carry both a current index and a prior-next “ondex”.

“Big” variants use a wider soft field and support larger index values than their small counterparts.

Variants§

§

Ed25519

Ed25519 indexed signature — "A"

§

Ed25519Crt

Ed25519 current-only indexed signature — "B"

§

ECDSA256k1

ECDSA secp256k1 indexed signature — "C"

§

ECDSA256k1Crt

ECDSA secp256k1 current-only indexed signature — "D"

§

ECDSA256r1

ECDSA P-256 indexed signature — "E"

§

ECDSA256r1Crt

ECDSA P-256 current-only indexed signature — "F"

§

Ed448

Ed448 indexed signature — "0A"

§

Ed448Crt

Ed448 current-only indexed signature — "0B"

§

Ed25519Big

Ed25519 big indexed signature — "2A"

§

Ed25519BigCrt

Ed25519 big current-only indexed signature — "2B"

§

ECDSA256k1Big

ECDSA secp256k1 big indexed signature — "2C"

§

ECDSA256k1BigCrt

ECDSA secp256k1 big current-only indexed signature — "2D"

§

ECDSA256r1Big

ECDSA P-256 big indexed signature — "2E"

§

ECDSA256r1BigCrt

ECDSA P-256 big current-only indexed signature — "2F"

§

Ed448Big

Ed448 big indexed signature — "3A"

§

Ed448BigCrt

Ed448 big current-only indexed signature — "3B"

Implementations§

Source§

impl IndexedSigCode

Source

pub fn frame_size(stream: &[u8]) -> Result<usize, IndexerParseError>

Full qb64 character size of the indexed primitive at the head of stream, without decoding raw bytes.

§Errors

IndexerParseError on unknown code, short stream, bad UTF-8, or size overflow.

Source§

impl IndexedSigCode

Source

pub const fn as_str(&self) -> &'static str

Returns the CESR wire code string for this variant.

Source

pub fn from_hard(hard: &str) -> Result<Self, CodeError>

Parses a hard code string back to the corresponding enum variant.

§Errors

Returns CodeError::UnknownCode if hard does not match any known indexed signature code.

Source

pub const fn get_xizage(&self) -> Xizage

Returns the Xizage sizage entry for this code (from the cesride reference table).

Source

pub const fn mode(&self) -> IndexMode

Returns the IndexMode for this code.

Both variants carry a current index and a prior-next “ondex”. CurrentOnly variants carry only the current index.

Source

pub const fn is_big(&self) -> bool

Returns true if this is a “big” variant with a wider index field.

Source

pub const fn raw_size(&self) -> usize

Returns the raw signature size in bytes.

Ed25519 and ECDSA (256-bit) signatures are 64 bytes. Ed448 signatures are 114 bytes. The size is the same regardless of small vs. big variants.

Source

pub const fn max_index(&self) -> u32

Returns the maximum index value this code can encode.

Formula: 64^(ss - os) - 1 where ss is the soft size and os is the ondex size from the sizage table.

Source

pub const fn max_ondex(&self) -> Option<u32>

Returns the maximum ondex (other-index) value, or None for current-only codes.

For Both-mode codes with os > 0: 64^os - 1. For Both-mode codes with os == 0 (small codes): the ondex must equal the index, so the max ondex equals max_index().

Source

pub const fn for_index(self, index: u32) -> Self

Auto-upgrades a small code to its big counterpart if index exceeds the small code’s maximum index capacity.

If the code is already big, or if index fits in the small code, returns self unchanged.

Trait Implementations§

Source§

impl Clone for IndexedSigCode

Source§

fn clone(&self) -> IndexedSigCode

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for IndexedSigCode

Source§

impl Debug for IndexedSigCode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for IndexedSigCode

Source§

impl Hash for IndexedSigCode

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for IndexedSigCode

Source§

fn eq(&self, other: &IndexedSigCode) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for IndexedSigCode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.