mirror of
https://github.com/Smaug123/ClassicalCiphers.jl
synced 2025-10-05 09:28:44 +00:00
37e40640a0208141fd7d83f24c95e74e82e1b2af
ClassicalCiphers
Main Features
Provides access to encryption and decryption of strings according to a variety of classical algorithms. The Solitaire cipher is included for completeness, though it is perhaps not strictly classical.
Currently Implemented
Gotchas
In general, encrypt
functions turn text upper-case, while decrypt
functions
turn text lower-case.
This is consistent with convention, but may not be expected.
Code samples
Caesar cipher
Encrypt the text "Hello, World!" with a Caesar offset of 3 (that is, sending 'a' to 'd'):
encrypt_caesar("Hello, World!", 3)
# outputs "khoor, zruog!"
Notice that encrypt_caesar
turns everything upper-case, but retains symbols.
Decrypt the same text:
decrypt_caesar("Khoor, Zruog!", 3)
# outputs "hello, world!"
Likewise, decrypt_caesar
turns everything lower-case, but retains symbols.
Monoalphabetic cipher
Encrypt the text "Hello, World!" with the same Caesar cipher, but viewed as a monoalphabetic substitution:
encrypt_monoalphabetic("Hello, World!", "DEFGHIJKLMNOPQRSTUVWXYZABC")
# outputs "KHOOR, ZRUOG!"
Description
Languages
Julia
100%