Skip to content

Hash to curve CPU/circuit discrepancy for message signature in Schnorr signature #2993

Closed

Description

@jpraynaud

Why

We have noticed a discrepancy between the CPU and circuit implementations of the hash to curve function used by the Schnorr signature scheme:

What

Fix the discrepancy by providing a hash to curve implementation in the CPU that matches the circuit's one.

How

  • Replace the slice of bytes entry of the hash_to_projective_point function with a slice of JubjubBase:
    pub(crate) fn hash_to_projective_point(inputs: &[JubjubBase]) -> StmResult<Self> { 
        let point = JubjubHashToCurveGadget::hash_to_curve(inputs);
        Ok(ProjectivePoint(JubjubExtended::from(point)))
    }
        let message = "digest123";
        let mut message_hash = Sha256::new();
        message_hash.update(message);
        let mut message_hash_input = [0u8; 32];
        message_hash_input.copy_from_slice(&message_hash.finalize());
        let message_hash_jubjub = JubjubBase::from_raw([
            u64::from_le_bytes(hashed_input[0..8].try_into()?),
            u64::from_le_bytes(hashed_input[8..16].try_into()?),
            u64::from_le_bytes(hashed_input[16..24].try_into()?),
            u64::from_le_bytes(hashed_input[24..32].try_into()?),
        ]);

Activity

  1. changed the title [-]Fix hash to curve CPU/circuit discrepancy for message signature in Schnorr signature[/-] [+]Hash to curve CPU/circuit discrepancy for message signature in Schnorr signature[/+] on Feb 10, 2026
  2. added
    bug ⚠️
    on Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug ⚠️cryptography 🔐

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions