pub struct CharCodec<T> { /* private fields */ }
Expand description
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 first version of the Bacon’s cipher.
Implementations§
Trait Implementations§
Source§impl<T: PartialEq + Clone> BaconCodec for CharCodec<T>
impl<T: PartialEq + Clone> BaconCodec for CharCodec<T>
Source§type ABTYPE = T
type ABTYPE = T
The type of the substitution characters A and B that produce a cipher output like ABABBBABBABAAABAABAAAAABABAAAAAABAABAABAABABBAABAABAAABBAAABAAAAAAABBAAABAA Read more
Source§fn encode_elem(&self, elem: &char) -> Vec<T>
fn encode_elem(&self, elem: &char) -> Vec<T>
Encodes a single emenent of
Self::CONTENT
to a Vec of Self::ABTYPE
.Source§fn decode_elems(&self, elems: &[T]) -> char
fn decode_elems(&self, elems: &[T]) -> char
Decode an array of elements to produce one element of
Self::CΟΝΤΕΝΤ
Source§fn encoded_group_size(&self) -> usize
fn encoded_group_size(&self) -> usize
Returns the the size of the group of elements that represent a content encoding. Read more
Source§fn is_a(&self, elem: &T) -> bool
fn is_a(&self, elem: &T) -> bool
Tests whether an element equals with the
A
substitution element.Source§fn is_b(&self, elem: &T) -> bool
fn is_b(&self, elem: &T) -> bool
Tests whether an element equals with the
B
substitution element.Source§impl Default for CharCodec<char>
impl Default for CharCodec<char>
Source§fn default() -> CharCodec<char>
fn default() -> CharCodec<char>
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’]
impl<T> StructuralPartialEq for CharCodec<T>
Auto Trait Implementations§
impl<T> Freeze for CharCodec<T>where
T: Freeze,
impl<T> RefUnwindSafe for CharCodec<T>where
T: RefUnwindSafe,
impl<T> Send for CharCodec<T>where
T: Send,
impl<T> Sync for CharCodec<T>where
T: Sync,
impl<T> Unpin for CharCodec<T>where
T: Unpin,
impl<T> UnwindSafe for CharCodec<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more