35
35
import qrencode
36
36
from tempfile import mkstemp
37
37
from datetime import datetime
38
- from shutil import which
39
38
from PIL import Image
40
39
from pyx import *
41
40
@@ -71,15 +70,6 @@ def finish_page(pdf, canv, pageno):
71
70
72
71
# main code
73
72
74
- if sys .argv [1 ] == "--b2sum" :
75
- if len (sys .argv ) > 2 :
76
- with open (sys .argv [2 ], 'r' ) as ifile :
77
- data = '' .join (ifile .readlines ())
78
- else :
79
- data = '' .join (sys .stdin .readlines ())
80
- print (hashlib .blake2b (bytes (data , 'utf8' )).hexdigest ())
81
- sys .exit (0 )
82
-
83
73
if len (sys .argv ) != 2 :
84
74
raise RuntimeError ('Usage {} FILENAME.asc' .format (sys .argv [0 ]))
85
75
@@ -182,7 +172,7 @@ def finish_page(pdf, canv, pageno):
182
172
chksumlines .append (line )
183
173
184
174
# we also want a checksum which the restored file should match
185
- b2sum = hashlib .blake2b (bytes (ascdata , 'utf8' )).hexdigest ()
175
+ checksum = hashlib .sha256 (bytes (ascdata , 'utf8' )).hexdigest ()
186
176
187
177
# add some documentation around the plaintest
188
178
outlines = []
@@ -192,9 +182,8 @@ def finish_page(pdf, canv, pageno):
192
182
outlines .extend (chksumlines )
193
183
outlines .append ("" )
194
184
outlines .append ("" )
195
- outlines .append ("b2sum of input file (split over 2 lines):" )
196
- outlines .append ("%s" % b2sum [:64 ])
197
- outlines .append ("%s" % b2sum [64 :])
185
+ outlines .append ("sha256sum of input file:" )
186
+ outlines .append ("%s" % checksum )
198
187
outlines .append ("" )
199
188
outlines .append ("" )
200
189
outlines .append ("--" )
0 commit comments