chore: Switch to sha256 from md5 to remedy CodeQL warning (#3356)

This use of md5 doesn't appear to be a cryptographically sensitive
    context, but the easiest remediation for the CodeQL warning is to
    switch to an approved hash function.
This commit is contained in:
kdestin 2024-08-20 13:58:36 -04:00 коммит произвёл GitHub
Родитель 6a36786a3f
Коммит cb3b0343fc
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -103,7 +103,7 @@ for orientation in ExifTags.TAGS.keys():
def get_hash(paths):
# Returns a single hash value of a list of paths (files or dirs)
size = sum(os.path.getsize(p) for p in paths if os.path.exists(p)) # sizes
h = hashlib.md5(str(size).encode()) # hash sizes
h = hashlib.sha256(str(size).encode()) # hash sizes
h.update("".join(paths).encode()) # hash paths
return h.hexdigest() # return hash