forked from 6iKezbAD3CZnf/merkletree-poseidon-cuda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cc_rust.cu
32 lines (27 loc) · 841 Bytes
/
cc_rust.cu
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
#include <cassert>
#include "merkle_tree.cuh"
extern "C"
F* calculate_digests_caps(F* leaves, uint32_t num_leaves, uint32_t leave_len, uint32_t cap_height) {
uint32_t num_caps = 1 << cap_height;
uint32_t num_digests = 2 * (num_leaves - num_caps);
uint32_t num_digests_caps = num_digests + num_caps;
assert(num_leaves > num_caps);
F* digests_cap = (F*)malloc(sizeof(F)*HASH_WIDTH*num_digests_caps);
// host_fill_digests_caps(
// digests_cap,
// num_digests,
// leaves,
// num_leaves,
// leave_len,
// cap_height
// );
device_fill_digests_caps(
digests_cap,
num_digests,
leaves,
num_leaves,
leave_len,
cap_height
);
return digests_cap;
}