hashes: add x86 SSE4 single-block acceleration

Open
#6,286 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
cpp, rust

Research direction

Start by reading the referenced Bitcoin Core file, src/crypto/sha256_sse4.cpp, and then inspect the repository's existing SHA256 optimizations. Decide whether the implementation should use Rust intrinsics or assembly, and define completion around adding x86 SSE4 single-block SHA256 acceleration without losing the consistency and portability considerations described in the issue.

Written by the indexing model from the issue text.

Description

Opening this so we don't lose track of it.

I think this is the only optimization left to do for SHA256.
AFAIK there isn’t currently a Rust crate that implements SHA256 with SSSE3 instructions, but the Assembly code can be found in Core https://github.com/bitcoin/bitcoin/blob/fbe628756cc417dd4b6ccd9d3a709ca8e2f6023c/src/crypto/sha256_sse4.cpp

tho It might be worth going with an all-intrinsics approach to stay consistent with the other optimizations we've done. This would also make it possible to provide Miri shims later, and avoid unexpected bugs like https://github.com/bitcoin/bitcoin/pull/34953.
As far as I know intrinsics have almost the same performance as the asm version anyway (or even slightly better)

Dominant language
Rust
Stars
2.7k
Forks
1.1k
Avg merge
3d 8h
Merged PRs (30d)
41

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rust-bitcoin/rust-bitcoin

All issues in rust-bitcoin/rust-bitcoin

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.