Skip to content

Minor fixes and tests for BinaryToHex()#10841

Open
julianbrost wants to merge 3 commits into
masterfrom
binarytohex-length
Open

Minor fixes and tests for BinaryToHex()#10841
julianbrost wants to merge 3 commits into
masterfrom
binarytohex-length

Conversation

@julianbrost
Copy link
Copy Markdown
Member

This PR fixes two issues in the BinaryToHex() function that didn't have real-world impact (yet), as it was only used for SHA1 hashes so far:

  1. It used a wrong constant instead of the length parameter in one place.
  2. It used int to iterate over the input, instead of size_t (which is already used for the length parameter).

While at it, I've also added some tests for the function.

fixes #10840

…NGTH

Forgot to replace one of the two uses of SHA_DIGEST_LENGTH with length in
6cd3a48. All users use it for SHA1 so far, so
there was no wrong usage yet.
int is just not the right type to use for an index variable, so change it to
size_t, even if it's unlikely to be called on sufficently large inputs that it
would actually make a difference.
@julianbrost julianbrost added this to the 2.17.0 milestone May 7, 2026
@julianbrost julianbrost added core/quality Improve code, libraries, algorithms, inline docs consider backporting Should be considered for inclusion in a bugfix release labels May 7, 2026
@cla-bot cla-bot Bot added the cla/signed label May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla/signed consider backporting Should be considered for inclusion in a bugfix release core/quality Improve code, libraries, algorithms, inline docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BinaryToHex loop ignores length parameter, hardcodes SHA_DIGEST_LENGTH

1 participant