MCPcopy Index your code
hub / github.com/subbarayudu-j/TheAlgorithms-Python / getTextFromBlocks

Function getTextFromBlocks

ciphers/rsa_cipher.py:52–62  ·  view source on GitHub ↗
(blockInts, messageLength, blockSize=DEFAULT_BLOCK_SIZE)

Source from the content-addressed store, hash-verified

50
51
52def getTextFromBlocks(blockInts, messageLength, blockSize=DEFAULT_BLOCK_SIZE):
53 message = []
54 for blockInt in blockInts:
55 blockMessage = []
56 for i in range(blockSize - 1, -1, -1):
57 if len(message) + i < messageLength:
58 asciiNumber = blockInt // (BYTE_SIZE ** i)
59 blockInt = blockInt % (BYTE_SIZE ** i)
60 blockMessage.insert(0, chr(asciiNumber))
61 message.extend(blockMessage)
62 return ''.join(message)
63
64
65def encryptMessage(message, key, blockSize=DEFAULT_BLOCK_SIZE):

Callers 1

decryptMessageFunction · 0.85

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected