mdist: Ensure correct format for sha256sum.
We conform to the format described at <https://www.gnu.org/software/coreutils/manual/html_node/md5sum-invocation.html>. and compatible with busybox and Perl's shasum utility.
This commit is contained in:
parent
d6ef5b2024
commit
1f7c8ec7e2
|
@ -48,7 +48,9 @@ def create_hash(fname):
|
|||
m = hashlib.sha256()
|
||||
m.update(open(fname, 'rb').read())
|
||||
with open(hashname, 'w') as f:
|
||||
f.write('{} {}\n'.format(m.hexdigest(), os.path.basename(fname)))
|
||||
# A space and an asterisk because that is the format defined by GNU coreutils
|
||||
# and accepted by busybox and the Perl shasum tool.
|
||||
f.write('{} *{}\n'.format(m.hexdigest(), os.path.basename(fname)))
|
||||
print(os.path.relpath(fname), m.hexdigest())
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue