3 import java.nio.ByteBuffer;
4 import java.nio.ByteOrder;
6 import com.google.common.base.Preconditions;
17 boolean isEnabled =
true;
19 System.loadLibrary(
"javasecp256k1");
20 }
catch (UnsatisfiedLinkError e) {
35 public static boolean verify(byte[]
data, byte[] signature, byte[] pub) {
36 Preconditions.checkArgument(
data.length == 32 && signature.length <= 520 && pub.length <= 520);
39 if (byteBuff == null) {
40 byteBuff = ByteBuffer.allocateDirect(32 + 8 + 520 + 520);
41 byteBuff.order(ByteOrder.nativeOrder());
46 byteBuff.putInt(signature.length);
47 byteBuff.putInt(pub.length);
48 byteBuff.put(signature);
static ThreadLocal< ByteBuffer > nativeECDSABuffer
static final boolean enabled
static boolean verify(byte[] data, byte[] signature, byte[] pub)
static native int secp256k1_ecdsa_verify(ByteBuffer byteBuff)