bugfix
This commit is contained in:
parent
0cee287283
commit
772736120b
10
crc16.py
10
crc16.py
@ -1,7 +1,5 @@
|
|||||||
import sys
|
import sys
|
||||||
import ast
|
import ast
|
||||||
import time
|
|
||||||
from itertools import zip_longest
|
|
||||||
|
|
||||||
class Polynomial:
|
class Polynomial:
|
||||||
|
|
||||||
@ -77,7 +75,7 @@ def normalize_byte(data):
|
|||||||
if len(data) < 8:
|
if len(data) < 8:
|
||||||
data = str(0) + data
|
data = str(0) + data
|
||||||
else:
|
else:
|
||||||
data.replace(data[0], '')
|
data = data[1:]
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
@ -126,7 +124,9 @@ def check_fcs(in_data):
|
|||||||
def main():
|
def main():
|
||||||
try:
|
try:
|
||||||
if sys.argv[1] == '-e' or sys.argv[1] == '-encode':
|
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':
|
elif sys.argv[1] == '-c' or sys.argv[1] == '-check':
|
||||||
print(check_fcs(sys.argv[2]))
|
print(check_fcs(sys.argv[2]))
|
||||||
else:
|
else:
|
||||||
@ -136,4 +136,4 @@ def main():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
Loading…
Reference in New Issue
Block a user