diff --git a/samcli/lib/utils/hash.py b/samcli/lib/utils/hash.py index 3c00eada966..62f0b1297f9 100644 --- a/samcli/lib/utils/hash.py +++ b/samcli/lib/utils/hash.py @@ -4,21 +4,13 @@ import hashlib import os -import sys from typing import Any, List, Optional, cast BLOCK_SIZE = 4096 -# earliest python version to support usedforsecurity option for hashlib.md5 is 3.9 -# https://docs.python.org/3/library/hashlib.html#hash-algorithms -_MAJOR_PYTHON_VERSION = 3 -_MINOR_PYTHON_VERSION = 9 def _get_md5(): - if sys.version_info.major >= _MAJOR_PYTHON_VERSION and sys.version_info.minor >= _MINOR_PYTHON_VERSION: - return hashlib.md5(usedforsecurity=False) - else: - return hashlib.md5() + return hashlib.md5(usedforsecurity=False) def file_checksum(file_name: str, hash_generator: Any = None) -> str: diff --git a/tests/unit/lib/utils/test_hash.py b/tests/unit/lib/utils/test_hash.py index bb7e5d0ef25..e7f9184816f 100644 --- a/tests/unit/lib/utils/test_hash.py +++ b/tests/unit/lib/utils/test_hash.py @@ -1,7 +1,6 @@ import hashlib import os import shutil -import sys import tempfile from unittest import TestCase from unittest.mock import patch @@ -127,7 +126,4 @@ def test_str_checksum(self): @patch("samcli.lib.utils.hash.hashlib") def test_md5_instantiation(self, patched_hashlib): str_checksum("dummy-data") - if sys.version_info.major >= 3 and sys.version_info.minor >= 9: - patched_hashlib.md5.assert_called_with(usedforsecurity=False) - else: - patched_hashlib.md5.assert_called_with() + patched_hashlib.md5.assert_called_with(usedforsecurity=False)