argumentcomputer / argumentcomputer/sphinx

SHA-512 improvements

Open
#181 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
80
Forks
8
PR merge metrics
No merged PRs in 30d

Description

As a follow-up to #179, things that we can improve in the SHA-512 implementation:

* The `Add` operation does not need to range check the inputs since we can assume they are bytes (either as an XOR result or because they come from the ZKVM) ([comment](https://github.com/argumentcomputer/sphinx/pull/179#discussion_r1780955687))
* Use an `Add4` gadget that accepts 64-bit words ([comment](https://github.com/argumentcomputer/sphinx/pull/179#discussion_r1780957054))
* Use a garbage-in/garbage-out approach for the `i` iteration counter. Technically, the circuit does not need to range-check the `i` values since the sha-512 lib will set up the right values and we can assume they are correct. If they are incorrect, you get a garbage result, but we don't need to explicitly check it. ([comment](https://github.com/argumentcomputer/sphinx/pull/179#discussion_r1780951141))

Contributor guide

Open the contributing guide

Research direction

Start with issue #179 and the linked discussion comments, then locate the SHA-512 implementation and trace the Add inputs, the word-addition gadget, and the i iteration counter. Done means applying the three listed circuit improvements while preserving correct SHA-512 results.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cryptography
Issue type
Refactor
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.