-
Notifications
You must be signed in to change notification settings - Fork 0
/
vrf_wrapper.c
42 lines (34 loc) · 1.05 KB
/
vrf_wrapper.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <sodium.h>
#include <emscripten.h>
EMSCRIPTEN_KEEPALIVE
int vrf_keypair(unsigned char *pk, unsigned char *sk) {
return crypto_vrf_keypair(pk, sk);
}
EMSCRIPTEN_KEEPALIVE
int vrf_prove(unsigned char *proof, const unsigned char *sk, const unsigned char *m, unsigned long long mlen) {
return crypto_vrf_prove(proof, sk, m, mlen);
}
EMSCRIPTEN_KEEPALIVE
int vrf_verify(unsigned char *output, const unsigned char *pk, const unsigned char *proof, const unsigned char *m, unsigned long long mlen) {
return crypto_vrf_verify(output, pk, proof, m, mlen);
}
EMSCRIPTEN_KEEPALIVE
int vrf_proof_to_hash(unsigned char *hash, const unsigned char *proof) {
return crypto_vrf_proof_to_hash(hash, proof);
}
EMSCRIPTEN_KEEPALIVE
size_t vrf_publickeybytes() {
return crypto_vrf_PUBLICKEYBYTES;
}
EMSCRIPTEN_KEEPALIVE
size_t vrf_secretkeybytes() {
return crypto_vrf_SECRETKEYBYTES;
}
EMSCRIPTEN_KEEPALIVE
size_t vrf_proofbytes() {
return crypto_vrf_PROOFBYTES;
}
EMSCRIPTEN_KEEPALIVE
size_t vrf_outputbytes() {
return crypto_vrf_OUTPUTBYTES;
}