Zadanie3 #28

Closed
s407228 wants to merge 18 commits from s407228/DALGLI0:Zadanie3 into master
Showing only changes of commit 9c6a607f34 - Show all commits

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