Skip to content

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

Description

@0xisk

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions