[][src]Struct bacon_cipher::codecs::char_codec::CharCodecV2

pub struct CharCodecV2<T> { /* fields omitted */ }

A codec that encodes data of type char.

The encoding is done by substituting with two given elements (elem_a and elem_b) of type T.

The substitution is done using the second version of the Bacon's cipher.

Methods

impl<T> CharCodecV2<T>[src]

pub fn new(elem_a: T, elem_b: T) -> CharCodecV2<T>[src]

Create a new CharCodec using elements elem_a and elem_b for substitution.

Trait Implementations

impl<T: PartialEq + Clone> BaconCodec for CharCodecV2<T>[src]

type ABTYPE = T

The type of the substitution characters A and B that produce a cipher output like ABABBBABBABAAABAABAAAAABABAAAAAABAABAABAABABBAABAABAAABBAAABAAAAAAABBAAABAA Read more

type CONTENT = char

The type of the content to be encoded to or decoded.

fn encode(&self, input: &[Self::CONTENT]) -> Vec<Self::ABTYPE>[src]

Encode an array of some type Self::CONTENT Read more

fn decode(&self, input: &[Self::ABTYPE]) -> Vec<Self::CONTENT>[src]

Decode an array of some type Self::ABTYPE. Read more

impl<T: Clone> Clone for CharCodecV2<T>[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<T: PartialEq> PartialEq<CharCodecV2<T>> for CharCodecV2<T>[src]

impl Default for CharCodecV2<char>[src]

fn default() -> CharCodecV2<char>[src]

A CharCodec with CONTENT=char, A='A' and B='B'

It encodes the following secret: ['M', 'y', ' ', 's', 'e', 'c', 'r', 'e', 't'] is

To: ['a', 'b', 'a', 'b', 'b', 'b', 'a', 'b', 'b', 'a', 'b', 'a', 'a', 'a', 'b', 'a', 'a', 'b', 'a', 'a', 'a', 'a', 'a', 'b', 'a', 'b', 'a', 'a', 'a', 'a', 'a', 'a', 'b', 'a', 'a', 'b', 'a', 'a', 'b', 'a']

Auto Trait Implementations

impl<T> Send for CharCodecV2<T> where
    T: Send

impl<T> Sync for CharCodecV2<T> where
    T: Sync

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.