From f0034fc3d8368475e89ab5bdaaedad6d2a0ad697 Mon Sep 17 00:00:00 2001 From: Danny Morton <102087408+dmorton714@users.noreply.github.com> Date: Wed, 6 Nov 2024 10:04:48 -0500 Subject: [PATCH 1/5] Update README.md --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 3564f70..7ba3811 100644 --- a/README.md +++ b/README.md @@ -33,9 +33,7 @@ Note that the program should not replace special characters like spaces or excla ## Instructions -1. GitHub Classroom will send you an email asking you to accept the assignment. -1. Once you've accepted, it will create a repo for you to add your code. -1. Clone your repo, add your code, and Commit/Push your changes to Github. +1. Fork and clone the repo, add your code, and Commit/Push your changes to Github. 1. Mentors will review your submissions and provide feedback. ### Optional: Automated Code Testing From 3535a9e2a324c7e92938cb0fa66415ef0bdda110 Mon Sep 17 00:00:00 2001 From: wipa12 Date: Tue, 12 Nov 2024 15:17:11 -0500 Subject: [PATCH 2/5] major updates --- cipher.py | 14 ++++++++++++++ pjs_decryption.py | 15 +++++++++++++++ pjs_decyption.py | 13 +++++++++++++ pjs_encryption.py | 14 ++++++++++++++ pjs_encyption.py | 16 ++++++++++++++++ 5 files changed, 72 insertions(+) create mode 100644 pjs_decryption.py create mode 100644 pjs_decyption.py create mode 100644 pjs_encryption.py create mode 100644 pjs_encyption.py diff --git a/cipher.py b/cipher.py index 0e772db..3b4072a 100644 --- a/cipher.py +++ b/cipher.py @@ -1 +1,15 @@ # add your code here +# my attempt at a caesare cipher: +### +# shift = 15 +choice =input("Type e to encrypt or d to decrypt") + +if choice == 'e': + import pjs_encryption + pjs_encryption.encryption +elif choice == 'd': + import pjs_decryption + pjs_decryption.decryption +else: + print ("wrong choice") + \ No newline at end of file diff --git a/pjs_decryption.py b/pjs_decryption.py new file mode 100644 index 0000000..c01f5c2 --- /dev/null +++ b/pjs_decryption.py @@ -0,0 +1,15 @@ +#decypt + +import string + +def decryption(): + + import string +plain_text = input("what do you want to decrypt? ") +shift1 = int(input("Please enter decrytion key ")) +shift = 26-shift1 +alphabet = string.ascii_lowercase +shifted = alphabet[shift:] + alphabet[:shift] +table = str.maketrans(alphabet, shifted) +decrypted = plain_text.translate(table) +print(decrypted) \ No newline at end of file diff --git a/pjs_decyption.py b/pjs_decyption.py new file mode 100644 index 0000000..9674bd3 --- /dev/null +++ b/pjs_decyption.py @@ -0,0 +1,13 @@ +import string + + +def decryption(): + + import string +plain_text = input("what do you want to decrypt? ") +shift = -int(input-26("Please enter decrytion key")) +alphabet = string.ascii_lowercase +shifted = alphabet[shift:] + alphabet[:shift] +table = str.maketrans(alphabet, shifted) +decrypted = plain_text.translate(table) +print(decrypted) \ No newline at end of file diff --git a/pjs_encryption.py b/pjs_encryption.py new file mode 100644 index 0000000..87ddc96 --- /dev/null +++ b/pjs_encryption.py @@ -0,0 +1,14 @@ +#my module for encryption + +import string + +def encryption(): + + import string +plain_text = input("what do you want to encrypt? ") +shift = input("Please enter encrytion key ") +alphabet = string.ascii_lowercase +shifted = alphabet[shift:] + alphabet[:shift] +table = str.maketrans(alphabet, shifted) +encrypted = plain_text.translate(table) +print(encrypted) \ No newline at end of file diff --git a/pjs_encyption.py b/pjs_encyption.py new file mode 100644 index 0000000..bdf6d35 --- /dev/null +++ b/pjs_encyption.py @@ -0,0 +1,16 @@ +#my module for encyption + + +import string + + +def encryption(): + + import string +plain_text = input("what do you want to encrypt? ") +shift = int(input("Please enter encrytion key")) +alphabet = string.ascii_lowercase +shifted = alphabet[shift:] + alphabet[:shift] +table = str.maketrans(alphabet, shifted) +encrypted = plain_text.translate(table) +print(encrypted) \ No newline at end of file From 04756feac5026d7ac5581f510fdc1f4653eeaadb Mon Sep 17 00:00:00 2001 From: wipa12 Date: Tue, 12 Nov 2024 15:18:32 -0500 Subject: [PATCH 3/5] removed old files --- pjs_decyption.py | 13 ------------- pjs_encyption.py | 16 ---------------- 2 files changed, 29 deletions(-) delete mode 100644 pjs_decyption.py delete mode 100644 pjs_encyption.py diff --git a/pjs_decyption.py b/pjs_decyption.py deleted file mode 100644 index 9674bd3..0000000 --- a/pjs_decyption.py +++ /dev/null @@ -1,13 +0,0 @@ -import string - - -def decryption(): - - import string -plain_text = input("what do you want to decrypt? ") -shift = -int(input-26("Please enter decrytion key")) -alphabet = string.ascii_lowercase -shifted = alphabet[shift:] + alphabet[:shift] -table = str.maketrans(alphabet, shifted) -decrypted = plain_text.translate(table) -print(decrypted) \ No newline at end of file diff --git a/pjs_encyption.py b/pjs_encyption.py deleted file mode 100644 index bdf6d35..0000000 --- a/pjs_encyption.py +++ /dev/null @@ -1,16 +0,0 @@ -#my module for encyption - - -import string - - -def encryption(): - - import string -plain_text = input("what do you want to encrypt? ") -shift = int(input("Please enter encrytion key")) -alphabet = string.ascii_lowercase -shifted = alphabet[shift:] + alphabet[:shift] -table = str.maketrans(alphabet, shifted) -encrypted = plain_text.translate(table) -print(encrypted) \ No newline at end of file From a8bfba04a3a67f51af4956f3f59048b85a019553 Mon Sep 17 00:00:00 2001 From: wipa12 Date: Wed, 13 Nov 2024 18:41:18 -0500 Subject: [PATCH 4/5] major changes --- cipher.py | 5 +++-- pjs_decryption.py | 3 ++- pjs_encryption.py | 8 +++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cipher.py b/cipher.py index 3b4072a..d648664 100644 --- a/cipher.py +++ b/cipher.py @@ -2,8 +2,7 @@ # my attempt at a caesare cipher: ### # shift = 15 -choice =input("Type e to encrypt or d to decrypt") - +choice =input("Type e to encrypt or d to decrypt: ") if choice == 'e': import pjs_encryption pjs_encryption.encryption @@ -12,4 +11,6 @@ pjs_decryption.decryption else: print ("wrong choice") + + \ No newline at end of file diff --git a/pjs_decryption.py b/pjs_decryption.py index c01f5c2..029e15d 100644 --- a/pjs_decryption.py +++ b/pjs_decryption.py @@ -6,8 +6,9 @@ def decryption(): import string plain_text = input("what do you want to decrypt? ") -shift1 = int(input("Please enter decrytion key ")) +shift1 = int(input("Please enter decrytion key. ")) shift = 26-shift1 +shift %= 26 alphabet = string.ascii_lowercase shifted = alphabet[shift:] + alphabet[:shift] table = str.maketrans(alphabet, shifted) diff --git a/pjs_encryption.py b/pjs_encryption.py index 87ddc96..80480e2 100644 --- a/pjs_encryption.py +++ b/pjs_encryption.py @@ -3,12 +3,14 @@ import string def encryption(): - - import string + + import string plain_text = input("what do you want to encrypt? ") -shift = input("Please enter encrytion key ") +shift = int(input("Please enter encrytion key. ")) alphabet = string.ascii_lowercase shifted = alphabet[shift:] + alphabet[:shift] table = str.maketrans(alphabet, shifted) + encrypted = plain_text.translate(table) + print(encrypted) \ No newline at end of file From f080b8a5a0d7be2a89490aa5e6992be159860e16 Mon Sep 17 00:00:00 2001 From: wipa12 Date: Sun, 17 Nov 2024 09:31:19 -0500 Subject: [PATCH 5/5] Update README.md --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 7ba3811..31b0a41 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,14 @@ +#Here is where my readme starts +## + +> My method of doing this was with slicing +i took one slice and added to the back of the second slice. +this created the shift needed for the encrytion. + +>to decrypt i uses the key given and subtracted 60 to get back to the coorrect order. +> I created to modules for fun one to encrypt and one tp decrypt. +>ii found this lesseon very informativer and helpfuil + # Caesar Cipher Exercise Code Louisville Python programming exercise.