File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ def cc_encryption(st, shift):
8
8
if i == " " :
9
9
res = res + space_substitute [random .randint (0 , 9 )]
10
10
elif 48 <= ord (i ) <= 57 :
11
- res = res + chr ((ord (i ) + shift - 48 ) + 48 )
11
+ res = res + chr ((ord (i ) + shift - 48 ) % 10 + 48 )
12
12
elif i .isupper ():
13
13
res = res + chr ((ord (i ) + shift - 65 ) % 26 + 65 )
14
14
else :
@@ -23,7 +23,7 @@ def cc_decryption(st, shift):
23
23
if i in space_substitute :
24
24
res = res + " "
25
25
elif 48 <= ord (i ) <= 57 :
26
- res = res + chr ((ord (i ) - shift - 48 ) + 48 )
26
+ res = res + chr ((ord (i ) - shift - 48 ) % 10 + 48 )
27
27
elif i .isupper ():
28
28
res = res + chr ((ord (i ) - shift - 65 ) % 26 + 65 )
29
29
else :
@@ -37,4 +37,4 @@ def cc_decryption(st, shift):
37
37
decrypted = cc_decryption (encrypted , move )
38
38
print ("Original text: " + string )
39
39
print ("Encrypted text: " + encrypted )
40
- print ("Decrypted text: " + decrypted )
40
+ print ("Decrypted text: " + decrypted )
You can’t perform that action at this time.
0 commit comments