Update 'Zadanie3'
This commit is contained in:
parent
c624158b50
commit
504f4a3c5a
7
Zadanie3
7
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"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user