RustCrypto / RustCrypto/universal-hashes

Add backend for 32 bit targets with wide multiplication?

Open
#133 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
39
Forks
23
Avg merge
1h 57m
Merged PRs (30d)
2

Description

Currently polyval (and thus crates built on top of it) uses 32-bit soft backend which was written with targets without wide multiplication in mind. However, this code can be quite inefficient for targets which do support wide multiplication, such as:

  • WASM32: u32s can be extended to 64 bits and multiplied using i64.mul.
  • RISC-V: wide multiplication is implemented by combining MULHU and MUL operations (hardware may fuse them later into a single instruction).

Also it may be worth to add a soft backend for 64-bit targets without wide multiplication? Though right now I can't name a target for which it could be useful.

Contributor guide

No contributing guide indexed for this repository

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 inspecting the existing 32-bit soft backend used by polyval, then compare how WASM32 and RISC-V expose wide multiplication. Determine the backend boundary and target conditions needed for the proposed implementation, and verify that the resulting backend preserves polyval behavior while improving support for targets with wide multiplication.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
cryptography
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.