pub struct Keyword(/* private fields */);Expand description
Keyword structure, used in constructing the matrix in which the encryption is performed over.
Implementations§
Source§impl Keyword
impl Keyword
Sourcepub fn new(initial: &str) -> Self
pub fn new(initial: &str) -> Self
Create a keyword from an initial input. This will have a size of 25 and will not have any duplicate letters, and equate the letter ‘i’ to the letter ‘j’. This is to conform to the 5x5 matrix that the Playfair cipher is used on. The letter ‘j’ was chosen arbitrarily due to its low use in the English language. This will mean that upon decryption, you’ll notice anything that once was a ‘j’ in the initial plain text is now an ‘i’.
§Example
Key: playfair
Message: Jane
Encrypted message: bpun
Decrypted of encryption: iane
Two things to note with this, it turns everything lowercase for easier searching and complexity, and j’s are now converted to i’s.
§TODO
According to
this post, using
.retain() on the initial filitering we do may be faster in release builds. Investigate
more.