feat: expose verifySchnorrFast in Secp256k1InstanceOurs + Android benchmark

Wire verifySchnorrFast (x-check only, no y-parity inversion) into:
- Secp256k1InstanceOurs wrapper for app-level usage
- Android benchmark as verifySchnorrFastOurs for Pixel 8 measurement

Expected: ~15% faster than verifySchnorrOurs (~100μs vs ~120μs on Pixel 8)

https://claude.ai/code/session_01EMY5RnXb9rnsyU2KbXrSaY
This commit is contained in:
Claude
2026-04-09 12:33:13 +00:00
parent 6e589c693c
commit fbcd0d6326
2 changed files with 17 additions and 0 deletions
@@ -123,6 +123,13 @@ class Secp256k1Benchmark {
}
}
@Test
fun verifySchnorrFastOurs() {
benchmarkRule.measureRepeated {
assertTrue(Secp256k1InstanceOurs.verifySchnorrFast(signature, msg32, xOnlyPub))
}
}
@Test
fun signSchnorrOurs() {
benchmarkRule.measureRepeated {
@@ -62,6 +62,16 @@ object Secp256k1InstanceOurs {
pubKey: ByteArray,
): Boolean = Secp256k1.verifySchnorr(signature, hash, pubKey)
/**
* Fast Nostr verify — skips BIP-340 y-parity inversion (~15% faster).
* Safe for Nostr event verification. See Secp256k1.verifySchnorrFast KDoc.
*/
fun verifySchnorrFast(
signature: ByteArray,
hash: ByteArray,
pubKey: ByteArray,
): Boolean = Secp256k1.verifySchnorrFast(signature, hash, pubKey)
fun privateKeyAdd(
first: ByteArray,
second: ByteArray,