forked from dayne/zunkfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzunkfs.h
26 lines (20 loc) · 765 Bytes
/
zunkfs.h
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
#ifndef __ZUNKFS_H__
#define __ZUNKFS_H__
#ifndef CHUNK_SIZE
#define CHUNK_SIZE (1UL << 16)
#endif
#define CHUNK_DIGEST_LEN 20
#define CHUNK_DIGEST_STRLEN (CHUNK_DIGEST_LEN * 2)
#define DIGESTS_PER_CHUNK (CHUNK_SIZE / CHUNK_DIGEST_LEN)
/*
* write_chunk() updates 'digest' field.
*/
int write_chunk(const unsigned char *chunk, unsigned char *digest);
int read_chunk(unsigned char *chunk, const unsigned char *digest);
void zero_chunk_digest(unsigned char *digest);
int random_chunk_digest(unsigned char *digest);
int verify_chunk(const unsigned char *chunk, const unsigned char *digest);
const char *__digest_string(const unsigned char *digest, char *strbuf);
#define digest_string(digest) \
__digest_string(digest, alloca(CHUNK_DIGEST_STRLEN + 1))
#endif