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

Function main

ciphers/affine_cipher.py:6–17  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4SYMBOLS = r""" !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"""
5
6def main():
7 message = input('Enter message: ')
8 key = int(input('Enter key [2000 - 9000]: '))
9 mode = input('Encrypt/Decrypt [E/D]: ')
10
11 if mode.lower().startswith('e'):
12 mode = 'encrypt'
13 translated = encryptMessage(key, message)
14 elif mode.lower().startswith('d'):
15 mode = 'decrypt'
16 translated = decryptMessage(key, message)
17 print('\n%sed text: \n%s' % (mode.title(), translated))
18
19def getKeyParts(key):
20 keyA = key // len(SYMBOLS)

Callers 1

affine_cipher.pyFile · 0.70

Calls 2

encryptMessageFunction · 0.70
decryptMessageFunction · 0.70

Tested by

no test coverage detected