(blockInts, messageLength, blockSize=DEFAULT_BLOCK_SIZE)
| 50 | |
| 51 | |
| 52 | def 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 | |
| 65 | def encryptMessage(message, key, blockSize=DEFAULT_BLOCK_SIZE): |
no test coverage detected