Fixed bug with spaces. Added README.
This commit is contained in:
parent
624382917e
commit
74275e823f
|
@ -0,0 +1,28 @@
|
||||||
|
# Python Caeser Cipher Helper
|
||||||
|
|
||||||
|
# What's That?
|
||||||
|
|
||||||
|
This script gives you tools to manipulate text with the Caeser Cipher.
|
||||||
|
It'll take any input you give it, filter it and process it as you want (encrypt or decrypt) and will attempt to crack it if you don't know the shift.
|
||||||
|
|
||||||
|
This is a fun tool, not security. The Caeser Cipher was broken in A.D. 800 (or earlier) for longer messages unless you use a one time pad and a randomly generated shift. But, it's fun to break and manipulate.
|
||||||
|
|
||||||
|
This tool is a work in progress.
|
||||||
|
|
||||||
|
# Requirements
|
||||||
|
|
||||||
|
Python `=>` 3.5.2
|
||||||
|
|
||||||
|
# Usage
|
||||||
|
|
||||||
|
### Encrypt
|
||||||
|
|
||||||
|
`python3 caeser-cipher.py encrypt "secretmessage"`
|
||||||
|
|
||||||
|
For example: `python3 caeser-cipher.py encrypt "Hi, how are you?""`
|
||||||
|
|
||||||
|
### Decrypt
|
||||||
|
|
||||||
|
`python3 caeser-cipher.py decrypt "encryptedtext"`
|
||||||
|
|
||||||
|
For example: `python3 caeser-cipher.py decrypt "hhhhhhhhhh"`
|
|
@ -1,4 +1,4 @@
|
||||||
# Python Caeser Cipher Helper v1.0.1
|
# Python Caeser Cipher Helper v1.0.2
|
||||||
# Usage (encrypt): python3 caeser-cipher.py encrypt secretmessage
|
# Usage (encrypt): python3 caeser-cipher.py encrypt secretmessage
|
||||||
# Usage (decrypt): python3 caeser-cipher.py decrypt secretmessage
|
# Usage (decrypt): python3 caeser-cipher.py decrypt secretmessage
|
||||||
|
|
||||||
|
@ -14,9 +14,9 @@ from sys import argv # Import tool to process command line arguments.
|
||||||
script, action, ciphertext = argv # Take command line input.
|
script, action, ciphertext = argv # Take command line input.
|
||||||
|
|
||||||
#ciphertext = input("Please type in your cipher text:") # Set variable cipertext to the input from user.
|
#ciphertext = input("Please type in your cipher text:") # Set variable cipertext to the input from user.
|
||||||
shiftNum = input("Please enter the shift used (Just hit enter if you don't know):") # Get input
|
shiftNum = input("Please enter the shift you would like to use (Just hit enter if you don't know the shift used):") # Get input
|
||||||
#action = input("Please enter encrypt or decrypt):") # Get input
|
#action = input("Please enter encrypt or decrypt):") # Get input
|
||||||
ciphertext = re.sub (r'([^a-zA-Z ]+?)', '', ciphertext) # Remove all non-letters.
|
ciphertext = re.sub (r'([^a-zA-Z]+?)', '', ciphertext) # Remove all non-letters.
|
||||||
ciphertext = ciphertext.lower() # Make it all lowercase. https://www.geeksforgeeks.org/isupper-islower-lower-upper-python-applications/
|
ciphertext = ciphertext.lower() # Make it all lowercase. https://www.geeksforgeeks.org/isupper-islower-lower-upper-python-applications/
|
||||||
letters = list(string.ascii_lowercase) # Use a list of lowercase letters. https://stackoverflow.com/questions/43918437/how-to-iterate-through-the-alphabet
|
letters = list(string.ascii_lowercase) # Use a list of lowercase letters. https://stackoverflow.com/questions/43918437/how-to-iterate-through-the-alphabet
|
||||||
letterCount = 0 # Set variable for keeping track of which letter in the ciphertext we're on.
|
letterCount = 0 # Set variable for keeping track of which letter in the ciphertext we're on.
|
||||||
|
|
Loading…
Reference in New Issue