diff --git a/benchmark/src/androidTest/java/com/vitorpamplona/quartz/benchmark/Secp256k1Benchmark.kt b/benchmark/src/androidTest/java/com/vitorpamplona/quartz/benchmark/Secp256k1Benchmark.kt index c23267118..c72ca82a5 100644 --- a/benchmark/src/androidTest/java/com/vitorpamplona/quartz/benchmark/Secp256k1Benchmark.kt +++ b/benchmark/src/androidTest/java/com/vitorpamplona/quartz/benchmark/Secp256k1Benchmark.kt @@ -123,6 +123,13 @@ class Secp256k1Benchmark { } } + @Test + fun verifySchnorrFastOurs() { + benchmarkRule.measureRepeated { + assertTrue(Secp256k1InstanceOurs.verifySchnorrFast(signature, msg32, xOnlyPub)) + } + } + @Test fun signSchnorrOurs() { benchmarkRule.measureRepeated { diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/utils/Secp256k1InstanceOurs.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/utils/Secp256k1InstanceOurs.kt index 324a83443..02b3f0036 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/utils/Secp256k1InstanceOurs.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/utils/Secp256k1InstanceOurs.kt @@ -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,