Skip to content

Commit b39242e

Browse files
authored
Update Caesar_Cipher.py
1 parent 3b37920 commit b39242e

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

Cryptography/Caesar_Cipher.py

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55
2. In the second line the user inputs the string as per his choice given in part 1.
66
"""
77

8-
9-
10-
11-
12-
138
from random import choice
149

1510
def decrypt(encrypted_string,key_val):
@@ -59,4 +54,29 @@ def encrypt(input_string,key_val):
5954
key_val = int(input('Enter the key value '))
6055
print('Decrypted string is : ' + decrypt(encrypted_string,key_val))
6156

62-
57+
"""
58+
Sample Test Case :
59+
Case 1 :
60+
User chooses to input string and encrypt the inputted string.
61+
input :
62+
string : escrsce
63+
key value : 5
64+
output :
65+
encrypted string : JXHxwhJ
66+
67+
Case 2 :
68+
User chooses to enter an encrypted string and decrypt it.
69+
input :
70+
string : trWEcere
71+
key value : 6
72+
output :
73+
Decrypted String : ZXDKIKXK
74+
75+
Explaination :
76+
In this program , we take the input string and key value .Once we get the key value , we substitute the alphabet of the string with the updated key value alphabet.
77+
For eg . if input character is A and key value is 3 , so it will be subsituted by D ( A + 3 = D)
78+
Also in case if the encrypted string consists of both lower and uppercase characters we convert the whole string to uppercase
79+
80+
'''
81+
82+

0 commit comments

Comments
 (0)