From e94c8b52d313dc0d66b9ed0b55032c4470f72475 Mon Sep 17 00:00:00 2001 From: rusty-bytes7 <147008821+rusty-bytes7@users.noreply.github.com> Date: Mon, 7 Oct 2024 20:24:28 -0400 Subject: [PATCH 1/2] Create caesarcipher.py This is a simple example of a Caesar Cipher for Hacktoberfest- this is my first-ever pull request! :) --- caesarcipher.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 caesarcipher.py 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 From 2464704a2d7a6f71b672586cc38e90a72665bfd9 Mon Sep 17 00:00:00 2001 From: rusty-bytes7 <147008821+rusty-bytes7@users.noreply.github.com> Date: Tue, 8 Oct 2024 18:05:38 -0400 Subject: [PATCH 2/2] Updated README to include program in list --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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. |