supranational / blst

Multilingual BLS12-381 signature library
Apache License 2.0
467 stars 177 forks source link

how to sign a msg hash instead of msg with rust bindings? #229

Open zhiqiangxu opened 3 months ago

zhiqiangxu commented 3 months ago

It's not crystally clear from the signatures alone here:

pub fn sign(
                &self,
                msg: &[u8],
                dst: &[u8],
                aug: &[u8],
            )

The golang version is much clearer and can be tuned here:

    if useHash {
        q = HashToG2(msg, dst, augSingle)
    } else {
        q = EncodeToG2(msg, dst, augSingle)
    }

How to make sign do EncodeToG2 instead of HashToG2 in rust?

dot-asm commented 2 months ago

Apparently there is no way. Rust bindings were originally put together with specific applications in mind, and I guess it wasn't originally a concern. And it wasn't an issue so far... Is it a general question or is there actual requirement for it?

zhiqiangxu commented 2 months ago

@dot-asm For me, this is a genuine requirement. I'm somewhat surprised that the API differs between Go and Rust.

dot-asm commented 2 months ago

I fail to interpret the response unambiguously. It sill sounds more like a general question,as if you personally are genuinely surprised there is a difference. Is there an actual requirement in form of a protocol specification?