From 504f4a3c5a94b4b084d7bd85fcd9aaa795620a2c Mon Sep 17 00:00:00 2001 From: Klaudia Kandulska Date: Fri, 29 Jun 2018 16:26:06 +0000 Subject: [PATCH] Update 'Zadanie3' --- Zadanie3 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Zadanie3 b/Zadanie3 index 6186275..59ad2f0 100644 --- a/Zadanie3 +++ b/Zadanie3 @@ -89,8 +89,8 @@ def decode(message,poly16,crc): l_poly16 = len(poly16) message = bytearray(message, 'ascii') message = format(int.from_bytes(message, "big"), "b") - dec = int(crc, 16) - crc2=bin(dec)[2:] + crc2=binascii.unhexlify(crc) + print(crc2) msg=message+crc2 while len(msg) % 8 != 0: msg = "0" + msg @@ -171,7 +171,8 @@ def encode(message, poly16): message_final = bytearray(message_final, 'ascii') d = bytearray(d, 'ascii') print("calosc : ", message_final) - print("crc : ", d) + print("crc hex : ", ab) + print("crc ascii : ", d) poly16 = "10001000000100001"