Skip to content

Commit

Permalink
Cracking an Encryption completed
Browse files Browse the repository at this point in the history
  • Loading branch information
subhayuroy committed Sep 16, 2020
1 parent 7afd832 commit 1c4d80d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions Cracking an Encryption/cracking.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import sys

def decrypt(k, cipher):
plaintext = ''
for each in cipher:
p = (ord(each) - k) % 126

if p < 32:
p += 95
plaintext += chr(p)
print(plaintext)

def main(argv):
if len(sys.argv) != 1:
sys.exit('Usage: cracking.py')
cipher = input("Enter message= ")

for i in range(1, 95):
decrypt(i, cipher)

if __name__ == '__main__':
main(sys.argv[1:])

0 comments on commit 1c4d80d

Please sign in to comment.