Skip to content

Avoid recomputing HMAC digests during comparison - #1101

Open
OskarEichler wants to merge 1 commit into
ruby:masterfrom
OskarEichler:codex/cache-hmac-comparison-digests
Open

Avoid recomputing HMAC digests during comparison#1101
OskarEichler wants to merge 1 commit into
ruby:masterfrom
OskarEichler:codex/cache-hmac-comparison-digests

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

Snapshot each HMAC digest once in HMAC#== and reuse those strings for the size check and constant-time comparison.

Verification

  • Current candidate: 630 tests / 4,624 assertions, zero failures/errors, two expected FIPS omissions
  • Release candidate: 597 tests / 4,411 assertions, zero failures/errors, two expected FIPS omissions
  • 100,000 comparisons: allocations 400,018 to 200,018; elapsed 0.215s to 0.099s locally
  • Native build succeeds with -Werror; gem build/install and Songstats HMAC integration pass

Comparison semantics and the constant-time primitive are unchanged; this only avoids two redundant digest snapshots.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant