diff options
author | Jean-Marie LEMETAYER <jean-marie.lemetayer@savoirfairelinux.com> | 2020-01-24 18:08:03 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-01-27 16:44:22 +0000 |
commit | 80e2216e2b41cb6170292009064864449bc48bbe (patch) | |
tree | 1a92ec1c3392f16e53e095ea493faefddcc539db | |
parent | d5a4a352723258b4d499d3a51f340109c4f36f60 (diff) | |
download | bitbake-contrib-80e2216e2b41cb6170292009064864449bc48bbe.tar.gz |
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/
Signed-off-by: Jean-Marie LEMETAYER <jean-marie.lemetayer@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | lib/bb/utils.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/bb/utils.py b/lib/bb/utils.py index 68ca4ef25..28368f0a6 100644 --- a/lib/bb/utils.py +++ b/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""" |