File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 4
4
#include < ostream>
5
5
#include < new>
6
6
7
+ // / Opaque type for C for use in FFI
7
8
struct HasherHandle {
8
9
Hasher *_0;
9
10
};
10
11
11
12
extern " C" {
12
13
14
+ // / Creates a new Hasher to compute CRC32 checksums
13
15
HasherHandle *hasher_new ();
14
16
17
+ // / Writes data to the Hasher
18
+ // /
15
19
// / # Safety
16
20
// /
17
21
// / Uses unsafe method calls
18
22
void hasher_write (HasherHandle *handle, const char *data, uintptr_t len);
19
23
24
+ // / Calculates the CRC32 checksum for data that's been written to the Hasher
25
+ // /
20
26
// / # Safety
21
27
// /
22
28
// / Uses unsafe method calls
23
29
uint32_t hasher_finalize (HasherHandle *handle);
24
30
31
+ // / Helper method to just calculate a CRC32 checksum directly for a string
25
32
uint32_t crc32_hash (const char *data, uintptr_t len);
26
33
27
34
} // extern "C"
You can’t perform that action at this time.
0 commit comments