SecomCipher

Struct SecomCipher 

Source
pub struct SecomCipher { /* private fields */ }
Expand description

SECOM cipher implementation.

SECOM is a VIC-derived cipher that uses a single key phrase and a frequency string to initialize its components: a straddling checkerboard and two columnar transpositions (one regular and one disrupted).

Implementations§

Source§

impl SecomCipher

Source

pub fn new(key_phrase: &str, freq: &str) -> Result<Self>

Creates a new SecomCipher instance.

§Arguments
  • key_phrase - A string of at least 20 letters used for key derivation.
  • freq - A 7-letter frequency string for the checkerboard (e.g., “ESTONIA”).

Trait Implementations§

Source§

impl Block for SecomCipher

Source§

fn encrypt(&self, dst: &mut [u8], src: &[u8]) -> usize

Encrypts source data into destination buffer.

This implementation performs:

  1. Preprocessing (uppercase, space conversion).
  2. Checkerboard encoding.
  3. Padding to a multiple of 5.
  4. First (regular) columnar transposition.
  5. Second (disrupted) columnar transposition.
Source§

fn decrypt(&self, dst: &mut [u8], src: &[u8]) -> usize

Decrypts source data into destination buffer.

This implementation performs:

  1. Second (disrupted) columnar transposition (reverse).
  2. First (regular) columnar transposition (reverse).
  3. Padding removal.
  4. Checkerboard decoding.
  5. Postprocessing.
Source§

fn block_size(&self) -> usize

Source§

impl Debug for SecomCipher

Source§

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

Formats the value using the given formatter. Read more

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> 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.