Skip to content

md5: replace magic numbers with MD5_DIGEST_LEN - #22377

Closed
vszakats wants to merge 2 commits into
curl:masterfrom
vszakats:md5magic
Closed

md5: replace magic numbers with MD5_DIGEST_LEN#22377
vszakats wants to merge 2 commits into
curl:masterfrom
vszakats:md5magic

Conversation

@vszakats

@vszakats vszakats commented Jul 23, 2026

Copy link
Copy Markdown
Member

There may be more of these, also for MD4 and possibly others.

Copilot AI review requested due to automatic review settings July 23, 2026 10:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes repeated hard-coded 16 values for MD5 output length and replaces them with the shared MD5_DIGEST_LEN constant, improving consistency and reducing the chance of mismatched digest-size assumptions across different crypto backends.

Changes:

  • Replace 16 with MD5_DIGEST_LEN in multiple MD5 backend implementations (nettle, PSA Crypto, Win32 CryptoAPI).
  • Use MD5_DIGEST_LEN for the declared result sizes in Curl_HMAC_MD5 and Curl_DIGEST_MD5 parameter tables.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vszakats vszakats closed this in 932e63a Jul 23, 2026
@vszakats
vszakats deleted the md5magic branch July 23, 2026 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants