spec: make full_hash look like dag_hash (#8911)

This commit is contained in:
Scott Wittenburg 2018-08-09 10:00:49 -06:00 committed by Todd Gamblin
parent bbcb2bb8ca
commit 2278c65d0a

View File

@ -1440,8 +1440,13 @@ def full_hash(self, length=None):
self.to_node_dict(hash_function=lambda s: s.full_hash()), self.to_node_dict(hash_function=lambda s: s.full_hash()),
default_flow_style=True, width=maxint) default_flow_style=True, width=maxint)
package_hash = self.package.content_hash() package_hash = self.package.content_hash()
sha = hashlib.sha256(yaml_text.encode('utf-8') + package_hash) sha = hashlib.sha1(yaml_text.encode('utf-8') + package_hash)
self._full_hash = base64.b32encode(sha.digest()).lower()
b32_hash = base64.b32encode(sha.digest()).lower()
if sys.version_info[0] >= 3:
b32_hash = b32_hash.decode('utf-8')
self._full_hash = b32_hash
return self._full_hash[:length] return self._full_hash[:length]