MCPcopy Create free account
hub / github.com/subbarayudu-j/TheAlgorithms-Python / brute_force

Function brute_force

ciphers/caesar_cipher.py:21–33  ·  view source on GitHub ↗
(strng)

Source from the content-addressed store, hash-verified

19 return decrypted
20
21def brute_force(strng):
22 key = 1
23 decrypted = ''
24 while key <= 94:
25 for x in strng:
26 indx = (ord(x) - key) % 256
27 if indx < 32:
28 indx = indx + 95
29 decrypted = decrypted + chr(indx)
30 print("Key: {}\t| Message: {}".format(key, decrypted))
31 decrypted = ''
32 key += 1
33 return None
34
35
36def main():

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected