diff --git a/crc16.py b/crc16.py index bd75c00..f3d1777 100644 --- a/crc16.py +++ b/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: @@ -136,4 +136,4 @@ def main(): if __name__ == "__main__": - main() + main() \ No newline at end of file