OpenZeppelin / OpenZeppelin/compact-contracts

dev: add a crypto/hash interface with a SHA-256 module

Open
#921 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
55
Forks
29
Avg merge
5d 7h
Merged PRs (30d)
25

Description

crypto/EcdhMask hashes with persistentHash directly, and every future module that needs an upgrade-stable hash would do the same, each choosing its own preimage layout and field reduction. There is no place that fixes the hash a scheme uses or lets a consumer swap it.

Add a crypto/hash/ directory with the IHasher contract type (digest and hashToField at T = Bytes<32>) and a Sha256 module behind it. A hash module's mock declares contract implements IHasher, so a drifting signature fails compilation, and a consumer changes hash by changing one import.

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 crypto/EcdhMask to understand the existing persistentHash usage, then inspect the surrounding crypto modules and project conventions. Add the crypto/hash/ contract and SHA-256 module with the stated IHasher methods and mock implementation; done means consumers can swap the hash through one import and the contracts compile.

Written by the indexing model from the issue text.

Assessment

Domain
cryptography
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.