Skip to content

Commit 4825b55

Browse files
committed
added features
1 parent 63c61ba commit 4825b55

File tree

5 files changed

+27
-24
lines changed

5 files changed

+27
-24
lines changed

caesar_cipher.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from extras import decor
44
import time
55
from option_validator import options
6+
from redo import redo
67

78
@decor
89
def display():
@@ -16,7 +17,11 @@ def display():
1617
print("Hello there! What can i help you with?")
1718
time.sleep(1)
1819
print("\n1. Encryption")
19-
print("2. Decryption\n")
20+
print("2. Decryption")
21+
print("3. Exit\n")
2022
time.sleep(1)
2123

22-
options()
24+
options()
25+
print('\nPress any key to continue')
26+
input()
27+
redo()

caesar_decryption.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ def intro():
77
time.sleep(1)
88
print(" Welcome To Caesar Cipher Decryptor")
99

10+
def note():
11+
print()
12+
print("NOTE: YOU ALWAYS NEED TO HAVE THE SAME KEY USED TO ENCRYPT THE TEXT!")
13+
1014
def caesar_decryption(ciphertext, key):
1115
decrypted_str = ""
1216

caesar_encryption.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ def intro():
77
time.sleep(1)
88
print(" Welcome To Caesar Cipher Encryptor")
99

10+
def note():
11+
print()
12+
print("NOTE: ALWAYS REMEMBER TO KEEP THE KEY SECURE! YOU NEED THE SAME KEY TO DECRYPT THE TEXT!")
13+
1014
def caesar_encryption(plaintext, key):
1115
encrypted_str = ""
1216

extras.py

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,11 @@ def load_a():
1313
sys.stdout.write(i)
1414
sys.stdout.flush()
1515
time.sleep(0.3)
16-
print()
17-
18-
def load_b():
19-
for j in '..............':
20-
sys.stdout.write(j)
21-
sys.stdout.flush()
22-
time.sleep(0.3)
23-
print()
24-
25-
def load_c():
26-
print('Almost there!')
27-
for k in '..............':
28-
sys.stdout.write(k)
29-
sys.stdout.flush()
30-
time.sleep(0.3)
3116
print('\n')
3217

33-
def load_d():
18+
def load_b():
3419
for i in 'Decrypting....':
3520
sys.stdout.write(i)
3621
sys.stdout.flush()
3722
time.sleep(0.3)
38-
print()
23+
print('\n')

option_validator.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import time
22
import os
3-
from extras import load_a, load_b, load_c, load_d
3+
import sys
4+
from extras import load_a, load_b
45
import caesar_encryption as ce
56
import caesar_decryption as cd
67

@@ -11,6 +12,7 @@ def options():
1112
time.sleep(1.5)
1213
os.system('cls')
1314
ce.intro()
15+
ce.note()
1416
print()
1517
time.sleep(1)
1618
plaintext = input("Enter the text: ")
@@ -20,14 +22,13 @@ def options():
2022
time.sleep(1)
2123
print("--------------------------")
2224
load_a()
23-
load_b()
24-
load_c()
2525
ce.caesar_encryption(plaintext, key)
2626

2727
elif option == '2':
2828
time.sleep(1.5)
2929
os.system('cls')
3030
cd.intro()
31+
cd.note()
3132
print()
3233
time.sleep(1)
3334
ciphertext = input("Enter the encrypted text: ")
@@ -36,11 +37,15 @@ def options():
3637
print()
3738
time.sleep(1)
3839
print("--------------------------")
39-
load_d()
4040
load_b()
41-
load_c()
4241
cd.caesar_decryption(ciphertext, key)
4342

43+
elif option == '3':
44+
time.sleep(1.5)
45+
os.system('cls')
46+
msg = "Thank you! :)\nSee you next time!"
47+
sys.exit(msg)
48+
4449
else:
4550
time.sleep(1.5)
4651
print("Invalid Option.")

0 commit comments

Comments
 (0)