crypto_bigint

Trait Encoding

Source
pub trait Encoding: Sized {
    type Repr: AsRef<[u8]> + AsMut<[u8]> + Copy + Clone + Sized;

    const BIT_SIZE: usize;
    const BYTE_SIZE: usize;

    // Required methods
    fn from_be_bytes(bytes: Self::Repr) -> Self;
    fn from_le_bytes(bytes: Self::Repr) -> Self;
    fn to_be_bytes(&self) -> Self::Repr;
    fn to_le_bytes(&self) -> Self::Repr;
}
Expand description

Encoding support.

Required Associated Constants§

Source

const BIT_SIZE: usize

Size of this integer in bits.

Source

const BYTE_SIZE: usize

Size of this integer in bytes.

Required Associated Types§

Source

type Repr: AsRef<[u8]> + AsMut<[u8]> + Copy + Clone + Sized

Byte array representation.

Required Methods§

Source

fn from_be_bytes(bytes: Self::Repr) -> Self

Decode from big endian bytes.

Source

fn from_le_bytes(bytes: Self::Repr) -> Self

Decode from little endian bytes.

Source

fn to_be_bytes(&self) -> Self::Repr

Encode to big endian bytes.

Source

fn to_le_bytes(&self) -> Self::Repr

Encode to little endian bytes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Encoding for Limb

Source§

const BIT_SIZE: usize = 64usize

Source§

const BYTE_SIZE: usize = 8usize

Source§

type Repr = [u8; 8]

Source§

impl Encoding for U64

Source§

const BIT_SIZE: usize = 64usize

Source§

const BYTE_SIZE: usize = 8usize

Source§

type Repr = [u8; 8]

Source§

impl Encoding for U128

Source§

const BIT_SIZE: usize = 128usize

Source§

const BYTE_SIZE: usize = 16usize

Source§

type Repr = [u8; 16]

Source§

impl Encoding for U192

Source§

const BIT_SIZE: usize = 192usize

Source§

const BYTE_SIZE: usize = 24usize

Source§

type Repr = [u8; 24]

Source§

impl Encoding for U256

Source§

const BIT_SIZE: usize = 256usize

Source§

const BYTE_SIZE: usize = 32usize

Source§

type Repr = [u8; 32]

Source§

impl Encoding for U384

Source§

const BIT_SIZE: usize = 384usize

Source§

const BYTE_SIZE: usize = 48usize

Source§

type Repr = [u8; 48]

Source§

impl Encoding for U448

Source§

const BIT_SIZE: usize = 448usize

Source§

const BYTE_SIZE: usize = 56usize

Source§

type Repr = [u8; 56]

Source§

impl Encoding for U512

Source§

const BIT_SIZE: usize = 512usize

Source§

const BYTE_SIZE: usize = 64usize

Source§

type Repr = [u8; 64]

Source§

impl Encoding for U576

Source§

const BIT_SIZE: usize = 576usize

Source§

const BYTE_SIZE: usize = 72usize

Source§

type Repr = [u8; 72]

Source§

impl Encoding for U768

Source§

const BIT_SIZE: usize = 768usize

Source§

const BYTE_SIZE: usize = 96usize

Source§

type Repr = [u8; 96]

Source§

impl Encoding for U896

Source§

const BIT_SIZE: usize = 896usize

Source§

const BYTE_SIZE: usize = 112usize

Source§

type Repr = [u8; 112]

Source§

impl Encoding for U1024

Source§

const BIT_SIZE: usize = 1_024usize

Source§

const BYTE_SIZE: usize = 128usize

Source§

type Repr = [u8; 128]

Source§

impl Encoding for U1536

Source§

const BIT_SIZE: usize = 1_536usize

Source§

const BYTE_SIZE: usize = 192usize

Source§

type Repr = [u8; 192]

Source§

impl Encoding for U1792

Source§

const BIT_SIZE: usize = 1_792usize

Source§

const BYTE_SIZE: usize = 224usize

Source§

type Repr = [u8; 224]

Source§

impl Encoding for U2048

Source§

const BIT_SIZE: usize = 2_048usize

Source§

const BYTE_SIZE: usize = 256usize

Source§

type Repr = [u8; 256]

Source§

impl Encoding for U3072

Source§

const BIT_SIZE: usize = 3_072usize

Source§

const BYTE_SIZE: usize = 384usize

Source§

type Repr = [u8; 384]

Source§

impl Encoding for U3584

Source§

const BIT_SIZE: usize = 3_584usize

Source§

const BYTE_SIZE: usize = 448usize

Source§

type Repr = [u8; 448]

Source§

impl Encoding for U4096

Source§

const BIT_SIZE: usize = 4_096usize

Source§

const BYTE_SIZE: usize = 512usize

Source§

type Repr = [u8; 512]

Source§

impl Encoding for U6144

Source§

const BIT_SIZE: usize = 6_144usize

Source§

const BYTE_SIZE: usize = 768usize

Source§

type Repr = [u8; 768]

Source§

impl Encoding for U8192

Source§

const BIT_SIZE: usize = 8_192usize

Source§

const BYTE_SIZE: usize = 1_024usize

Source§

type Repr = [u8; 1024]