Skip to content

chore: add hash and encoding test vectors - #102

Merged
anurag629 merged 1 commit into
codercops:developfrom
kudala-bharani:chore/98-encoding-test-vectors
Oct 1, 2026
Merged

anurag629 merged 1 commit into
codercops:developfrom
kudala-bharani:chore/98-encoding-test-vectors

Conversation

@kudala-bharani

Copy link
Copy Markdown
Contributor

What and why

Closes #98.

Adds the requested reference vectors for MD5 and the encoding helpers. This covers empty input, the 55/56/64-byte MD5 padding boundaries, all five hash keys and digests, partial Ascii85 groups, zero-byte abbreviation, hex formatting, line wrapping, byte sizes, and shell/SQL quoting.

The MD5 boundary values were generated once with Node's crypto.createHash and stored as constants. Ascii85 vectors were also checked against Python's standard-library encoder. No production code changes were needed.

Type of change

  • Test coverage

Checklist

  • npm run lint && npm run test && npm run build passes locally
  • Tests live in lib/__tests__/; no production logic changes
  • No analytics, trackers, or calls that send user data off-device
  • Works in both light and dark themes (not applicable; no UI changes)

Notes for reviewers

One test file changed, with 29 new test cases. On Node 22.23.3, all 56 tests pass and the production build succeeds. Lint exits successfully with 13 existing warnings in unchanged files; the modified test file has no warnings.

@anurag629 anurag629 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hey @kudala-bharani, really nice work! I checked the MD5 padding values with Node's crypto and the Ascii85 ones with Python, all of them match. This covers everything in #98.

Small thing for next time, drop a comment on the issue first so I can assign it to you. Saves two people from doing the same work.

If you want to pick up another one, just comment on any open hacktoberfest issue and I'll assign it to you.

@anurag629 anurag629 added the hacktoberfest-accepted PR counts for Hacktoberfest label Oct 1, 2026
@anurag629
anurag629 merged commit 4df42d3 into codercops:develop Oct 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest-accepted PR counts for Hacktoberfest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add test vectors for the MD5 hash and the other encoders in lib/base64-utils.ts

2 participants