From e9c233746f0e8161b5e16ffd0966adf1ff081a43 Mon Sep 17 00:00:00 2001 From: Daniel Nelson Date: Wed, 31 May 2017 12:29:39 -0700 Subject: [PATCH] Generate sha256 hashes when packaging --- scripts/build.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/build.py b/scripts/build.py index 7e6719aff..d391ec2e1 100755 --- a/scripts/build.py +++ b/scripts/build.py @@ -499,13 +499,12 @@ def build(version=None, logging.info("Time taken: {}s".format((end_time - start_time).total_seconds())) return True -def generate_md5_from_file(path): - """Generate MD5 signature based on the contents of the file at path. +def generate_sha256_from_file(path): + """Generate SHA256 hash signature based on the contents of the file at path. """ - m = hashlib.md5() + m = hashlib.sha256() with open(path, 'rb') as f: - for chunk in iter(lambda: f.read(4096), b""): - m.update(chunk) + m.update(f.read()) return m.hexdigest() def generate_sig_from_file(path): @@ -790,9 +789,10 @@ def main(args): if not upload_packages(packages, bucket_name=args.bucket, overwrite=args.upload_overwrite): return 1 logging.info("Packages created:") - for p in packages: - logging.info("{} (MD5={})".format(p.split('/')[-1:][0], - generate_md5_from_file(p))) + for filename in packages: + logging.info("%s (SHA256=%s)", + os.path.basename(filename), + generate_sha256_from_file(filename)) if orig_branch != get_current_branch(): logging.info("Moving back to original git branch: {}".format(args.branch)) run("git checkout {}".format(orig_branch))