* Fixup for #6 Behaviour was changed in the JNI wapper but not in Kotlin native code. * Set version to 0.2.1-1.4-M3
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package fr.acinq.secp256k1
|
||||
|
||||
import kotlin.random.Random
|
||||
import kotlin.test.*
|
||||
|
||||
|
||||
@@ -265,4 +266,24 @@ class Secp256k1Test {
|
||||
Hex.encode(der).toUpperCase(),
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testFormatConversion() {
|
||||
val random = Random.Default
|
||||
|
||||
fun randomBytes(length: Int): ByteArray {
|
||||
val buffer = ByteArray(length)
|
||||
random.nextBytes(buffer)
|
||||
return buffer
|
||||
}
|
||||
|
||||
repeat(200) {
|
||||
val priv = randomBytes(32)
|
||||
val pub = Secp256k1.pubkeyCreate(priv)
|
||||
val data = randomBytes(32)
|
||||
val sig = Secp256k1.sign(data, priv)
|
||||
val der = Secp256k1.compact2der(sig)
|
||||
Secp256k1.verify(der, data, pub)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user