Skip to content

Commit c3b892b

Browse files
committed
more features
1 parent 9b2ae27 commit c3b892b

11 files changed

+99
-35
lines changed
1.33 KB
Binary file not shown.
233 Bytes
Binary file not shown.
256 Bytes
Binary file not shown.

__pycache__/decors.cpython-39.pyc

466 Bytes
Binary file not shown.

__pycache__/extras.cpython-39.pyc

1.24 KB
Binary file not shown.

__pycache__/loaders.cpython-39.pyc

972 Bytes
Binary file not shown.

caesar_cipher.py

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1-
#Caeser Cipher Algorithm for encryption and decryption
1+
#Caeser Cipher Algorithm for Encryption and Decryption
22

3-
import caesar_encryption, caesar_decryption
3+
from caesar_encryption import caesar_encryption, intro
4+
from caesar_decryption import caesar_decryption
5+
from extras import decor, load_a, load_b, load_c, load_d
46
import time
5-
import sys
6-
7-
def decor(func):
8-
def wrap():
9-
print("[=======================================]")
10-
func()
11-
print("\n[=======================================]")
12-
return wrap
137

148
@decor
159
def display():
@@ -29,33 +23,36 @@ def display():
2923
option = input("Input an option: ")
3024

3125
if option == '1':
26+
time.sleep(1.5)
27+
intro()
28+
print()
29+
time.sleep(1)
3230
plaintext = input("Enter the text: ")
31+
time.sleep(0.5)
3332
key = int(input("Enter the key: "))
34-
35-
for i in 'Encrypting....':
36-
sys.stdout.write(i)
37-
sys.stdout.flush()
38-
time.sleep(0.3)
39-
print()
40-
41-
for j in '..............':
42-
sys.stdout.write(j)
43-
sys.stdout.flush()
44-
time.sleep(0.3)
45-
print()
46-
47-
for k in 'Almost there....':
48-
sys.stdout.write(k)
49-
sys.stdout.flush()
50-
time.sleep(0.3)
51-
print('\n')
52-
53-
caesar_encryption.caesar_encryption(plaintext, key)
33+
time.sleep(1)
34+
print("--------------------------")
35+
load_a()
36+
load_b()
37+
load_c()
38+
caesar_encryption(plaintext, key)
5439

5540
elif option == '2':
41+
time.sleep(1.5)
42+
intro()
43+
print()
44+
time.sleep(1)
5645
ciphertext = input("Enter the encrypted text: ")
46+
time.sleep(0.5)
5747
key = int(input("Enter the key:"))
58-
caesar_decryption.caesar_decryption(ciphertext, key)
48+
time.sleep(1)
49+
print("--------------------------")
50+
load_d()
51+
load_b()
52+
load_c()
53+
caesar_decryption(ciphertext, key)
5954

6055
else:
56+
time.sleep(1.5)
57+
print()
6158
print("invalid option")

caesar_decryption.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
#Decryption algorithm
22
import time
3+
#import sys
4+
from extras import decor
5+
6+
@decor
7+
def intro():
8+
time.sleep(1)
9+
print(" Welcome To Caesar Cipher Decryptor")
310

411
def caesar_decryption(ciphertext, key):
512
decrypted_str = ""
6-
#welcome to caesar cipher decryptor
13+
714
for i in ciphertext:
815

916
if i.isupper():
@@ -30,4 +37,9 @@ def caesar_decryption(ciphertext, key):
3037
decrypted_str = decrypted_str + i
3138

3239
time.sleep(1)
33-
print("The decrypted text is:", decrypted_str)
40+
print("The decrypted text is:", decrypted_str)
41+
42+
# for i in decrypted_str:
43+
# sys.stdout.write(i)
44+
# sys.stdout.flush()
45+
# time.sleep(0.2)

caesar_encryption.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
#Encryption algorithm
22
import time
3+
#import sys
4+
from extras import decor
5+
6+
@decor
7+
def intro():
8+
print(" Welcome To Caesar Cipher Encryptor")
39

410
def caesar_encryption(plaintext, key):
511
encrypted_str = ""
6-
#welcome to caeser cipher encryptor
12+
713
for i in plaintext:
814

915
if i.isupper():
@@ -18,4 +24,9 @@ def caesar_encryption(plaintext, key):
1824
encrypted_str = encrypted_str + i
1925

2026
time.sleep(1)
21-
print("The encrypted text is:", encrypted_str)
27+
print("The encrypted text is:", encrypted_str)
28+
29+
# for i in encrypted_str:
30+
# sys.stdout.write(i)
31+
# sys.stdout.flush()
32+
# time.sleep(0.2)

extras.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import sys
2+
import time
3+
4+
def decor(func):
5+
def wrap():
6+
print("[=======================================]")
7+
func()
8+
print("[=======================================]")
9+
return wrap
10+
11+
def load_a():
12+
for i in 'Encrypting....':
13+
sys.stdout.write(i)
14+
sys.stdout.flush()
15+
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+
for k in 'Almost there....':
27+
sys.stdout.write(k)
28+
sys.stdout.flush()
29+
time.sleep(0.3)
30+
print('\n')
31+
32+
def load_d():
33+
for i in 'Decrypting....':
34+
sys.stdout.write(i)
35+
sys.stdout.flush()
36+
time.sleep(0.3)
37+
print()

0 commit comments

Comments
 (0)