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

Function encryptMessage

ciphers/transposition_cipher.py:17–28  ·  view source on GitHub ↗

>>> encryptMessage(6, 'Harshil Darji') 'Hlia rDsahrij'

(key, message)

Source from the content-addressed store, hash-verified

15 print('Output:\n%s' %(text + '|'))
16
17def encryptMessage(key, message):
18 """
19 >>> encryptMessage(6, 'Harshil Darji')
20 'Hlia rDsahrij'
21 """
22 cipherText = [''] * key
23 for col in range(key):
24 pointer = col
25 while pointer < len(message):
26 cipherText[col] += message[pointer]
27 pointer += key
28 return ''.join(cipherText)
29
30def decryptMessage(key, message):
31 """

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected