FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat: Indicate that md5 is used as a CRC by xnox · Pull Request #1522 · googleapis/python-storage · GitHub

This repository was archived by the owner on Mar 31, 2026. It is now read-only.
/ python-storage Public archive
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
6 changes: 5 additions & 1 deletion google/cloud/storage/_helpers.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import datetime
from hashlib import md5
import os
import sys
from urllib.parse import urlsplit
from urllib.parse import urlunsplit
from uuid import uuid4
Expand Down Expand Up @@ -536,7 +537,10 @@ def _base64_md5hash(buffer_object):
:rtype: str
:returns: A base64 encoded digest of the MD5 hash.
"""
hash_obj = md5()
if sys.version_info >= (3, 9):
hash_obj = md5(usedforsecurity=False)
else:
hash_obj = md5()
_write_buffer_to_hash(buffer_object, hash_obj)
digest_bytes = hash_obj.digest()
return base64.b64encode(digest_bytes)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test__helpers.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ def __init__(self, digest_val):
self.hash_obj = _MD5Hash(digest_val)
self._called = []

def __call__(self, data=None):
def __call__(self, data=None, usedforsecurity=True):
self._called.append(data)
return self.hash_obj

Expand Down

Back | FazBrowse Home | New Git URL