From bdcd68f092bcd803f08524c30c99e2a082462fd1 Mon Sep 17 00:00:00 2001 From: Jean-Marie LEMETAYER Date: Fri, 24 Jan 2020 18:08:03 +0100 Subject: bitbake: utils: add sha384_file and sha512_file functions The npm fetcher needs these functions to support the subresource integrity: https://www.w3.org/TR/SRI/ (Bitbake rev: 80e2216e2b41cb6170292009064864449bc48bbe) Signed-off-by: Jean-Marie LEMETAYER Signed-off-by: Richard Purdie --- bitbake/lib/bb/utils.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'bitbake/lib/bb/utils.py') diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 68ca4ef25a..28368f0a60 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py @@ -556,6 +556,20 @@ def sha1_file(filename): import hashlib return _hasher(hashlib.sha1(), filename) +def sha384_file(filename): + """ + Return the hex string representation of the SHA384 checksum of the filename + """ + import hashlib + return _hasher(hashlib.sha384(), filename) + +def sha512_file(filename): + """ + Return the hex string representation of the SHA512 checksum of the filename + """ + import hashlib + return _hasher(hashlib.sha512(), filename) + def preserved_envvars_exported(): """Variables which are taken from the environment and placed in and exported from the metadata""" -- cgit v1.2.3-54-g00ecf