diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-12-17 14:53:06 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-01-08 11:15:58 +0000 |
commit | 66f1b766997d53b4375fdd25719b1175f3828903 (patch) | |
tree | 370a67f7fa3901f6ae10c448d9bc6ee8e59d7b5e /lib | |
parent | 4bed7a97198176503fe8c72d8dd7c36b28fc9dd1 (diff) | |
download | bitbake-contrib-66f1b766997d53b4375fdd25719b1175f3828903.tar.gz |
data/siggen: Switch md5 -> sha256
Similarly to the codeparser change, change to sha256 hashes due to worries
over collisions. The main impact of this change is slightly slower parsing
time as well as longer sstate file names.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bb/data.py | 2 | ||||
-rw-r--r-- | lib/bb/data_smart.py | 2 | ||||
-rw-r--r-- | lib/bb/siggen.py | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/lib/bb/data.py b/lib/bb/data.py index 6bcfcf46c..29c238803 100644 --- a/lib/bb/data.py +++ b/lib/bb/data.py @@ -436,7 +436,7 @@ def generate_dependency_hash(tasklist, gendeps, lookupcache, whitelist, fn): if var is not None: data = data + str(var) k = fn + "." + task - basehash[k] = hashlib.md5(data.encode("utf-8")).hexdigest() + basehash[k] = hashlib.sha256(data.encode("utf-8")).hexdigest() taskdeps[task] = alldeps return taskdeps, basehash diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py index c342adaa0..1f45cd975 100644 --- a/lib/bb/data_smart.py +++ b/lib/bb/data_smart.py @@ -1074,4 +1074,4 @@ class DataSmart(MutableMapping): data.update({i:value}) data_str = str([(k, data[k]) for k in sorted(data.keys())]) - return hashlib.md5(data_str.encode("utf-8")).hexdigest() + return hashlib.sha256(data_str.encode("utf-8")).hexdigest() diff --git a/lib/bb/siggen.py b/lib/bb/siggen.py index 5508523f2..66aea7935 100644 --- a/lib/bb/siggen.py +++ b/lib/bb/siggen.py @@ -216,7 +216,7 @@ class SignatureGeneratorBasic(SignatureGenerator): self.taints[k] = taint logger.warning("%s is tainted from a forced run" % k) - h = hashlib.md5(data.encode("utf-8")).hexdigest() + h = hashlib.sha256(data.encode("utf-8")).hexdigest() self.taskhash[k] = h #d.setVar("BB_TASKHASH_task-%s" % task, taskhash[task]) return h @@ -650,7 +650,7 @@ def calc_basehash(sigdata): if val is not None: basedata = basedata + str(val) - return hashlib.md5(basedata.encode("utf-8")).hexdigest() + return hashlib.sha256(basedata.encode("utf-8")).hexdigest() def calc_taskhash(sigdata): data = sigdata['basehash'] @@ -668,7 +668,7 @@ def calc_taskhash(sigdata): else: data = data + sigdata['taint'] - return hashlib.md5(data.encode("utf-8")).hexdigest() + return hashlib.sha256(data.encode("utf-8")).hexdigest() def dump_sigfile(a): |