Skip to content

Pre-hashing signature messages #322

@Tabaie

Description

@Tabaie

I think it would be best to modify the Signer interface as follows:

type Signer interface {
  ⋮
  Sign(msg []byte) ([]byte, error)
  SignNum(msg big.Int, hFunc hash.Hash) ([]byte, error)
  ⋮
}

Sign takes in long messages such as human-readable strings. It then performs a hash-to-fr on the message, and passes it on to SignNum with nil as hFunc. Just like the current logic for Sign, when hFunc==nil, the input is considered pre-hashed and not hashed again. The hash used for hashing to Fr is a conventional one, but that would not create an issue on the SNARK side because any human-readable string can be reasonably expected to be known at SNARK compile time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions