Zadanie 3 - CRC #27
8
crc16.py
8
crc16.py
@ -1,7 +1,5 @@
|
||||
import sys
|
||||
import ast
|
||||
import time
|
||||
from itertools import zip_longest
|
||||
|
||||
class Polynomial:
|
||||
|
||||
@ -77,7 +75,7 @@ def normalize_byte(data):
|
||||
if len(data) < 8:
|
||||
data = str(0) + data
|
||||
else:
|
||||
data.replace(data[0], '')
|
||||
data = data[1:]
|
||||
return data
|
||||
|
||||
|
||||
@ -126,7 +124,9 @@ def check_fcs(in_data):
|
||||
def main():
|
||||
try:
|
||||
if sys.argv[1] == '-e' or sys.argv[1] == '-encode':
|
||||
print(encode(sys.argv[2]))
|
||||
arg = encode(sys.argv[2])
|
||||
print(arg)
|
||||
print(check_fcs(arg)) # powinno zawsze zwracać true
|
||||
elif sys.argv[1] == '-c' or sys.argv[1] == '-check':
|
||||
print(check_fcs(sys.argv[2]))
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user