I implemented a RSA algorithm on python. But I have a problem with the fact that you need to present any message in numerical form (a set of digits) in order to raise to a power. The difficulty is that if you do this with the ascii, how do you know how many digits are in the ascii code of the character 1, 2 or 3, for the unambiguous decode. Are there other options?
def decodeMessage(self, encodedMessage):
decodedBlocks = []
for block in encodedMessage:
decoded = self.mod_exp(block, self.e, self.N)
decodedBlocks.append(decoded)
return decodedBlocks