Skip to main content

RC5ControlBlock

Struct RC5ControlBlock 

Source
pub struct RC5ControlBlock<W: Word> { /* private fields */ }
Expand description

§RC5 control block

This struct represents the internal state of an RC5 cipher with a given word size. It encapsulates key expansion (S table), the number of rounds, and a computed version tag.

Parameters:

  • W: The word type (e.g., u16, u32, u64), which must implement the Word trait.

Implementations§

Source§

impl<W: Word> RC5ControlBlock<W>

Source

pub fn new<K>(key: K, rounds: usize) -> Result<Self, Reason>
where K: AsRef<[u8]>,

RC5 constructor method

It creates an instance of an RC5 control block from raw key and rounds.

Returns a result type containing the control block.

Source

pub fn s_table(&self) -> &[W]

Returns a reference to the expanded S table used for round keys.

Source

pub fn rounds(&self) -> usize

Source

pub fn parametric_version(&self) -> String

Returns a string describing the parametric RC5 version, e.g. "RC5-32/12/16".

Trait Implementations§

Source§

impl<W: Word> BlockCipher<W, 2> for RC5ControlBlock<W>

Source§

fn encrypt(&self, pt: [W; 2]) -> [W; 2]

Raw encryption, encrypt a single [W;N] block. Read more
Source§

fn decrypt(&self, ct: [W; 2]) -> [W; 2]

Raw decryption, decrypt a single [W;N] block. Read more
Source§

fn generate_blocks(&self, pt: Vec<u8>) -> Vec<[W; 2]>

Split a byte‐vector into a Vec of length-N word blocks. More generally, it creates a list of blocks from a stream of plain bytes.
Source§

fn generate_bytes_stream(&self, blocks: Vec<[W; 2]>) -> Vec<u8>

Generates a stream of bytes from a list of blocks. More specefically from N word blocks list generates byte-vector. Its counterfiet of generate_blocks method.
Source§

fn control_block_version(&self) -> String

Human‐readable version tag, mostly a parametric version. e.g. in RC5-block-cipher “RC5-32/12/16”.
Source§

fn block_size(&self) -> usize

Base block-size in bytes for a block-cipher.
Source§

fn word_size(&self) -> usize

Word-szie in bytes per block for a block-cipher.

Auto Trait Implementations§

§

impl<W> Freeze for RC5ControlBlock<W>

§

impl<W> RefUnwindSafe for RC5ControlBlock<W>
where W: RefUnwindSafe,

§

impl<W> Send for RC5ControlBlock<W>
where W: Send,

§

impl<W> Sync for RC5ControlBlock<W>
where W: Sync,

§

impl<W> Unpin for RC5ControlBlock<W>
where W: Unpin,

§

impl<W> UnsafeUnpin for RC5ControlBlock<W>

§

impl<W> UnwindSafe for RC5ControlBlock<W>
where W: UnwindSafe,

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> 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, 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V