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)
message = bytearray(message, 'ascii')
message = format(int.from_bytes(message, "big"), "b")
while len(message) % 8 != 0:
message = "0" + message
dec = int(crc, 16)
crc2=bin(dec)[2:]
while len(crc2) % 8 != 0:
crc2 = "0" + crc2
msg=message+crc2
while len(msg) % 8 != 0:
msg = "0" + msg
@ -153,4 +157,4 @@ def main():
crc = argv[3]
decode(sys.argv[1],sys.argv[3])
if __name__ == '__main__':
main()
main()