pub struct Skipjack { /* private fields */ }
Expand description

Struct representing a Skipjack cipher instance.

Implementations

Constructs a new SkipJack instance

Arguments
  • key - 80-bit SkipJackKey (Array of 10 bytes)

SkipJack encryption function

SkipJack encrypts 64-bit data blocks in-place by alternating between the two stepping rules A and B.

The encryption requires a total of 32 steps. It begins with step 0 (counter at 1) and steps according to Rule A for 8 steps, then switches to Rule B for the next 8 steps.

This procedure is repeated once, after which the ciphertext is returned.

Arguments
  • block - 16-bit plaintext array of length 4
Examples
use skipjack_rs::*;

let skipjack = Skipjack::new([0x00, 0x99, 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11].into());

let mut buf = [0x3322, 0x1100, 0xddcc, 0xbbaa].into();
skipjack.encrypt(&mut buf);

assert_eq!(buf, [0x2587, 0xcae2, 0x7a12, 0xd300].into());

SkipJack decryption function

SkipJack decrypts 64-bit data block in-place by alternating between the two stepping rules A and B in reverse order.

The decryption, just like the encryption, requires a total of 32 steps. It begins with step 32 (counter at 32) and counts down to 0. It steps according to Rule B for 8 steps, then switches to Rule A for 8 steps.

This procedure is repeated once, after which the plaintext is returned.

Arguments
  • block - 16-bit ciphertext array of length 4
Examples
use skipjack_rs::*;

let skipjack: Skipjack =
       Skipjack::new([0x00, 0x99, 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11].into());
    
let mut buf = [0x2587, 0xcae2, 0x7a12, 0xd300].into();
skipjack.decrypt(&mut buf);

assert_eq!(buf, [0x3322, 0x1100, 0xddcc, 0xbbaa].into());

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.