mirror of
https://github.com/Smaug123/ClassicalCiphers.jl
synced 2025-10-15 06:18:40 +00:00
Add Vigenere cracking capability
This commit is contained in:
14
README.md
14
README.md
@@ -118,6 +118,19 @@ decrypt_vigenere("HFLMOXOSLE", [0, 1])
|
||||
|
||||
Notice that the offset `0` corresponds to the key `a`.
|
||||
|
||||
Crack a text:
|
||||
|
||||
```julia
|
||||
crack_vigenere(str)
|
||||
```
|
||||
|
||||
This attempts to use the index of coincidence to find the keylength,
|
||||
and then performs frequency analysis to derive the key.
|
||||
It returns (key, decrypted text).
|
||||
|
||||
If the keylength is known, specifying it as `crack_vigenere(str, keylength=6)`
|
||||
may aid decryption.
|
||||
|
||||
### Solitaire cipher
|
||||
|
||||
Encrypt the text "Hello, World!" with the Solitaire cipher, key "crypto":
|
||||
@@ -134,6 +147,7 @@ decrypt_solitaire("EXKYI ZSGEH UNTIQ", collect(1:54))
|
||||
# outputs "aaaaaaaaaaaaaaa", as per https://www.schneier.com/code/sol-test.txt
|
||||
```
|
||||
|
||||
|
||||
[Caesar]: https://en.wikipedia.org/wiki/Caesar_cipher
|
||||
[Vigenère]: https://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher
|
||||
[Monoalphabetic substitution]: https://en.wikipedia.org/wiki/Substitution_cipher
|
||||
|
Reference in New Issue
Block a user