rust-bitcoin / rust-bitcoin/rust-bitcoin

hashes: add x86 SSE4 single-block acceleration

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

Nobody has claimed this yet.

Dominant language
Rust
Stars
2.7k
Forks
1k
Avg merge
4d 1h
Merged PRs (30d)
88

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)

Contributor guide

Open the contributing guide

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.

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.