@@ -157,7 +157,6 @@ class PackageMetadata(TypedDict, total=False):
157157filetype :str
158158gpg_signature :Tuple [str ,bytes ]
159159attestations :str
160- md5_digest :str
161160sha256_digest :str
162161blake2_256_digest :str
163162
@@ -188,7 +187,6 @@ def __init__(
188187hasher .hash ()
189188hexdigest = hasher .hexdigest ()
190189
191- self .md5_digest = hexdigest .md5
192190self .sha2_digest = hexdigest .sha2
193191self .blake2_256_digest = hexdigest .blake2
194192
@@ -274,7 +272,7 @@ def metadata_dictionary(self) -> PackageMetadata:
274272
275273# Additional meta-data: some of these fileds may not be set. Some
276274# package repositories do not allow null values, so this only sends
277- # non-null values. In particular, FIPS disablesMD5 and Blake2, making
275+ # non-null values. In particular, FIPS disables Blake2, making
278276# the digest values null. See https://github.com/pypa/twine/issues/775
279277
280278if self .comment is not None :
@@ -289,9 +287,6 @@ def metadata_dictionary(self) -> PackageMetadata:
289287if self .attestations is not None :
290288data ["attestations" ]= json .dumps (self .attestations )
291289
292- if self .md5_digest :
293- data ["md5_digest" ]= self .md5_digest
294-
295290if self .blake2_256_digest :
296291data ["blake2_256_digest" ]= self .blake2_256_digest
297292
@@ -352,7 +347,6 @@ def run_gpg(cls, gpg_args: Tuple[str, ...]) -> None:
352347
353348
354349class Hexdigest (NamedTuple ):
355- md5 :Optional [str ]
356350sha2 :Optional [str ]
357351blake2 :Optional [str ]
358352
@@ -367,13 +361,6 @@ def __init__(self, filename: str) -> None:
367361"""Initialize our manager and hasher objects."""
368362self .filename = filename
369363
370- self ._md5_hasher = None
371- try :
372- self ._md5_hasher = hashlib .md5 ()
373- except ValueError :
374- # FIPs mode disables MD5
375- pass
376-
377364self ._sha2_hasher = hashlib .sha256 ()
378365
379366self ._blake_hasher = None
@@ -383,15 +370,6 @@ def __init__(self, filename: str) -> None:
383370# FIPS mode disables blake2
384371pass
385372
386- def _md5_update (self ,content :bytes )-> None :
387- if self ._md5_hasher is not None :
388- self ._md5_hasher .update (content )
389-
390- def _md5_hexdigest (self )-> Optional [str ]:
391- if self ._md5_hasher is not None :
392- return self ._md5_hasher .hexdigest ()
393- return None
394-
395373def _sha2_update (self ,content :bytes )-> None :
396374if self ._sha2_hasher is not None :
397375self ._sha2_hasher .update (content )
@@ -414,14 +392,12 @@ def hash(self) -> None:
414392"""Hash the file contents."""
415393with open (self .filename ,"rb" )as fp :
416394for content in iter (lambda :fp .read (io .DEFAULT_BUFFER_SIZE ),b"" ):
417- self ._md5_update (content )
418395self ._sha2_update (content )
419396self ._blake_update (content )
420397
421398def hexdigest (self )-> Hexdigest :
422399"""Return the hexdigest for the file."""
423400return Hexdigest (
424- self ._md5_hexdigest (),
425401self ._sha2_hexdigest (),
426402self ._blake_hexdigest (),
427403 )