Skip to content

Add basic SHA1 support#207

Open
ctz wants to merge 1 commit into
mainfrom
jbp-sha1
Open

Add basic SHA1 support#207
ctz wants to merge 1 commit into
mainfrom
jbp-sha1

Conversation

@ctz

@ctz ctz commented Jul 5, 2026

Copy link
Copy Markdown
Owner

fixes #205

@codspeed-hq

codspeed-hq Bot commented Jul 5, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 173 untouched benchmarks


Comparing jbp-sha1 (a7f25bc) with main (977f10a)

Open in CodSpeed

@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.78%. Comparing base (977f10a) to head (a7f25bc).

Additional details and impacted files
@@           Coverage Diff            @@
##             main     #207    +/-   ##
========================================
  Coverage   99.78%   99.78%            
========================================
  Files         216      217     +1     
  Lines       56505    56621   +116     
  Branches      230      234     +4     
========================================
+ Hits        56382    56499   +117     
+ Misses         92       91     -1     
  Partials       31       31            

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread graviola/src/mid/sha1.rs
@@ -0,0 +1,207 @@
// Written for Graviola by Joe Birr-Pixton, 2025.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should the 2025 here be 2026?

Comment thread graviola/src/mid/sha1.rs
}

let (whole_blocks, remainder) = {
let whole_len = bytes.len() - (bytes.len() & (Self::BLOCK_SZ - 1));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I checked out of curiosity, and rustc does this optimization (replacing x % BLOCK_SZ with x & (BLOCK_SZ - 1) when BLOCK_SZ is a power of two) automatically.

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.

SHA1 support

2 participants