From 0ef3d4cde99a8288339338d3ed9285a71c404236 Mon Sep 17 00:00:00 2001 From: Holden Rohrer Date: Mon, 11 Nov 2019 23:03:23 -0500 Subject: fixed endianness bugs --- final/rsa-decrypt.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'final/rsa-decrypt.py') diff --git a/final/rsa-decrypt.py b/final/rsa-decrypt.py index 335ed68..d05b351 100644 --- a/final/rsa-decrypt.py +++ b/final/rsa-decrypt.py @@ -17,13 +17,13 @@ def decrypt_block(blk): decrypted = [decrypt_block(block) for block in encrypted] messagenum = 0 -for block in decrypted: - messagenum += block - messagenum *= n +for blockind in range(len(decrypted)): + block = decrypted[blockind] + messagenum += block * n ** blockind message = '' while messagenum > 0: - message += chr(messagenum%128) + message = chr(messagenum%128) + message messagenum = (messagenum-messagenum%128)//128 print(message) -- cgit