1
0
forked from kalmar/DALGLI0

Update 'Zadanie3'

This commit is contained in:
Klaudia Kandulska 2018-06-29 21:11:50 +00:00
parent 1dc92f3872
commit 9c6a607f34

View File

@ -87,8 +87,12 @@ def decode(message,crc):
l_poly16 = len(poly16) l_poly16 = len(poly16)
message = bytearray(message, 'ascii') message = bytearray(message, 'ascii')
message = format(int.from_bytes(message, "big"), "b") message = format(int.from_bytes(message, "big"), "b")
while len(message) % 8 != 0:
message = "0" + message
dec = int(crc, 16) dec = int(crc, 16)
crc2=bin(dec)[2:] crc2=bin(dec)[2:]
while len(crc2) % 8 != 0:
crc2 = "0" + crc2
msg=message+crc2 msg=message+crc2
while len(msg) % 8 != 0: while len(msg) % 8 != 0:
msg = "0" + msg msg = "0" + msg