We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0ce6ef7 commit eca5f5eCopy full SHA for eca5f5e
Substitution Cipher/Substitution Cipher.py
@@ -8,7 +8,7 @@ def sc_encryption(st, shift):
8
if i == " ":
9
res = res + space_substitute[random.randint(0, 9)]
10
elif 48 <= ord(i) <= 57:
11
- res = res + chr((ord(i) + shift - 48) + 48)
+ res = res + chr((ord(i) + shift - 48) % 10 + 48)
12
elif i.isupper():
13
res = res + chr((ord(i) + shift - 65) % 26 + 65)
14
else:
@@ -23,7 +23,7 @@ def sc_decryption(st, shift):
23
if i in space_substitute:
24
res = res + " "
25
26
- res = res + chr((ord(i) - shift - 48) + 48)
+ res = res + chr((ord(i) - shift - 48) % 10 + 48)
27
28
res = res + chr((ord(i) - shift - 65) % 26 + 65)
29
0 commit comments