download: support multiple hash algorithm

This commit is contained in:
Max Gautier
2024-12-21 21:42:06 +01:00
parent ff3d9a0443
commit ff768cc9fe

View File

@@ -272,7 +272,10 @@ def download_hash(only_downloads: [str]) -> None:
allow_redirects=True)
hash_file.raise_for_status()
if downloads[component].get('binary', False):
return hashlib.sha256(hash_file.content).hexdigest()
return hashlib.new(
downloads[component].get('hashtype', 'sha256'),
hash_file.content
).hexdigest()
return (hash_file.content.decode().split()[0])