Simple cryptographic substitution-based cipher for encoding plaintext.
Project description
MyCaesarCipher
Simple cryptographic substitution-based cipher for encoding plaintext.
About
-
The Caesar Cipher is one of the most simple and well known encryption techniques.
- Each letter in the plaintext entry is replaced by a letter some fixed number of positions down the alphabet.
-
This project was created as an exercise while I was taking the "Cracking Codes with Python" course - which I highly recommend for both beginners and experienced python programmers interested in cryptography!
Installation
Using pip (Recommended)
Easiest method. Highly recommended over manual installation.
- Run the following to install
MyCaesarCipher
usingpip
:
pip install MyCaesarCipher
- You should now be able to import/run
MyCaesarCipher
within your python environment by entering the following:
>>> from MyCaesarCipher import CaesarCipher
...
- Done!
Manual Installation
Not recommended.
-
Before use, navigate to intended installation location, and create a new directory.
-
Install all dependencies for this package within said directory using:
pip install -r requirements.txt
-
Clone repository with the git client of your preference.
- (Optional) move installation directory to
"path/to/Python/Libs/site_packages/"
to be able to import this package to a Python program like any other importable package.
- (Optional) move installation directory to
- Done!
Usage
- Within a Python environment or
.py
project, simply import theMyCaesarCipher
module to start encryption/decryption of ciphers.
Message Encryption
- For encrypting text, use the
CaesarCipher.encrypt
class method:
>>> from MyCaesarCipher import CaesarCipher
>>> encoder = CaesarCipher() # Create new class instance.
>>> code = 'Test Cipher'
>>> encoder.encrypt(text=code, key=200, consoleOutput=True)
> Original Msg : Test Cipher
> Shift-Key : 200
> Encrypted Result: LwklfUahzwj
- Therefore the final encrypted result using a shift-key of 200 is:
- "
LwklfUahzwj
".
- "
Message Decryption
- For decrypting text, use the
CaesarCipher.decrypt
class method:
>>> from MyCaesarCipher import CaesarCipher
>>> decoder = CaesarCipher() # Create new class instance.
>>> code = 'OznoiXdkczm'
>>> decoder.decrypt(text=code, consoleOutput=True)
> Decrypted Shift-Key 0 : OZNOIXDKCZM
> Decrypted Shift-Key 1 : NYMNHWCJBYL
> Decrypted Shift-Key 2 : MXLMGVBIAXK
> Decrypted Shift-Key 3 : LWKLFUAHZWJ
> Decrypted Shift-Key 4 : KVJKETZGYVI
> Decrypted Shift-Key 5 : JUIJDSYFXUH
> Decrypted Shift-Key 6 : ITHICRXEWTG
> Decrypted Shift-Key 7 : HSGHBQWDVSF
> Decrypted Shift-Key 8 : GRFGAPVCURE
> Decrypted Shift-Key 9 : FQEFZOUBTQD
> Decrypted Shift-Key 10 : EPDEYNTASPC
> Decrypted Shift-Key 11 : DOCDXMSZROB
> Decrypted Shift-Key 12 : CNBCWLRYQNA
> Decrypted Shift-Key 13 : BMABVKQXPMZ
> Decrypted Shift-Key 14 : ALZAUJPWOLY
> Decrypted Shift-Key 15 : ZKYZTIOVNKX
> Decrypted Shift-Key 16 : YJXYSHNUMJW
> Decrypted Shift-Key 17 : XIWXRGMTLIV
> Decrypted Shift-Key 18 : WHVWQFLSKHU
> Decrypted Shift-Key 19 : VGUVPEKRJGT
> Decrypted Shift-Key 20 : UFTUODJQIFS
> Decrypted Shift-Key 21 : TESTNCIPHER # <- Correct Result
> Decrypted Shift-Key 22 : SDRSMBHOGDQ
> Decrypted Shift-Key 23 : RCQRLAGNFCP
> Decrypted Shift-Key 24 : QBPQKZFMEBO
> Decrypted Shift-Key 25 : PAOPJYELDAN
-
The
CaesarCipher.decrypt
method will return all possible shifted-key variations of the given encrypted message. -
Generally, the most legible key output will be the correct decrypted message, assuming the encrypted message was legible to begin with.
-
Regardless, the correct output MUST be one of the output values due to the limitations of the algorithm being tied to the length of the alphabet [26] and amount of possible numbers [0-9].
Contact
-
If you have any questions, comments, or concerns that cannot be alleviated through the project's GitHub repository, please feel free to contact me through my email address:
schloppdaddy@gmail.com
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for MyCaesarCipher-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fca8b0a987104b3ad574ada320b2c436f48cb0565425e661c59eb8b6bdbb88c0 |
|
MD5 | a7aabe8292878f38a1ea4c6d4223c723 |
|
BLAKE2b-256 | fb1c13bddfacd88841e6d929eb5ba6bb0638d88b237870b910d5fe5e82e11ed2 |