File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ def crc16(data):
36
36
crc = 0xFFFF
37
37
for c in data :
38
38
crc = (((crc >> 8 ) & 0xFF ) | (crc << 8 )) & 0xFFFF
39
- crc = (crc ^ ord (c )) & 0xFFFF
39
+ crc = (crc ^ ( c if isinstance ( c , int ) else ord (c ) )) & 0xFFFF
40
40
crc = (crc ^ ((crc & 0xFF ) >> 4 )) & 0xFFFF
41
41
crc = (crc ^ ((crc << 8 ) << 4 )) & 0xFFFF
42
42
crc = (crc ^ (((crc & 0xFF ) << 4 ) << 1 )) & 0xFFFF
@@ -71,7 +71,7 @@ def create_app_signature(data):
71
71
action = 'store_true' ,
72
72
help = 'disable all console output unless an error occurs' )
73
73
args = parser .parse_args ()
74
-
74
+
75
75
# Make sure input filename exists.
76
76
if not os .path .isfile (args .input ):
77
77
raise RuntimeError ('Input file does not exist!' )
@@ -90,13 +90,13 @@ def create_app_signature(data):
90
90
91
91
# Generate and write signature.
92
92
if not args .quiet :
93
- print 'Writing signature to: {0}' .format (signature )
93
+ print ( 'Writing signature to: {0}' .format (signature ) )
94
94
with open (signature , 'wb' ) as out_file :
95
95
out_file .write (create_app_signature (data ))
96
96
97
97
# Done!
98
98
if not args .quiet :
99
- print 'Done!'
99
+ print ( 'Done!' )
100
100
101
101
102
102
# Unit Tests.
You can’t perform that action at this time.
0 commit comments