diff --git a/README.md b/README.md index 97710f02..e989ee40 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,8 @@ More information on contributing and the general code of conduct for discussion | Autocomplete Notes App | [AutoCert](https://github.com/DhanushNehru/Python-Scripts/tree/master/Autocomplete%20Notes%20App) | A Python script to auto-generate e-certificates in bulk. | | Automated Emails | [Automated Emails](https://github.com/DhanushNehru/Python-Scripts/tree/master/Automate%20Emails%20Daily) | A Python script to send out personalized emails by reading a CSV file. | | Black Hat Python | [Black Hat Python](https://github.com/DhanushNehru/Python-Scripts/tree/master/Black%20Hat%20Python) | Source code from the book Black Hat Python | -| Blackjack | [Blackjack](https://github.com/DhanushNehru/Python-Scripts/tree/master/Blackjack) | A game of Blackjack - let's get a 21. | +| Blackjack | [Blackjack](https://github.com/DhanushNehru/Python-Scripts/tree/master/Blackjack) | A game of Blackjack - let's get a 21. +|Caesar Cipher | [Caesar Cipher](https://github.com/rusty-bytes7/Python-Scripts/blob/e94c8b52d313dc0d66b9ed0b55032c4470f72475/caesarcipher.py) | A Python script to encrypt messages using the Caesar cipher. | | Chessboard | [Chessboard](https://github.com/DhanushNehru/Python-Scripts/tree/master/Chess%20Board) | Creates a chessboard using matplotlib. | | Compound Interest Calculator | [Compound Interest Calculator](https://github.com/DhanushNehru/Python-Scripts/tree/master/Calculate%20Compound%20Interest) | A Python script to calculate compound interest. | | Countdown Timer | [Countdown Timer](https://github.com/DhanushNehru/Python-Scripts/tree/master/Countdown%20Timer) | Displays a message when the Input time elapses. | diff --git a/caesarcipher.py b/caesarcipher.py new file mode 100644 index 00000000..d4466f4f --- /dev/null +++ b/caesarcipher.py @@ -0,0 +1,21 @@ +#this program is a simple caesar cipher, which encrypts +#a message by shifting each letter three to the right in the alphabet +#this will ignore all characters that are not letters + +def caesar_encrypt(plaintext): + #each letter in plaintext + finalstring= "" + for letter in plaintext.lower(): + #get the number value of the letter + cipher = (ord(letter)+3) + #wraparound + #checks letter to see if it's out of range + if cipher > 122: + cipher -= 26 + finalstring += chr(cipher) + #skips any other characters + elif (ord(letter)) in range (97,123): + finalstring +=chr(cipher) + else: + continue + return(finalstring) \ No newline at end of file