top of page
Writer's pictureVlad

[CodeWithMe]Bruteforce and Decrypt Cipher in Python



In this entry we are going to code a program that would bruteforce a cipher code and decrypt its message.


Code:


import pyperclip

message = raw_input("Enter message to decrypt: ")

LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

print "Bruteforcing..."

for key in range(len(LETTERS)):
	translated = ''

	for symbol in message:
		if symbol in LETTERS:
			num = LETTERS.find(symbol)
			num = num - key

if num < 0: num = num + len(LETTERS) translated = translated + LETTERS[num] else: translated = translated + symbol print('Attempt #%s: %s' % (key, translated))


To run and test the output, click on this link for video tutorial >>>



95 views0 comments

Comments


LET'S TAKE IT TO THE NEXT LEVEL!

bottom of page