[go: up one dir, main page]

File: md5.h

package info (click to toggle)
fio 3.33-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 10,896 kB
  • sloc: ansic: 78,615; sh: 5,191; python: 4,795; makefile: 832; yacc: 204; lex: 184
file content (29 lines) | stat: -rw-r--r-- 681 bytes parent folder | download | duplicates (6)
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
#ifndef MD5_H
#define MD5_H

#include <stdint.h>

#define MD5_DIGEST_SIZE		16
#define MD5_HMAC_BLOCK_SIZE	64
#define MD5_BLOCK_WORDS		16
#define MD5_HASH_WORDS		4

#define F1(x, y, z)	(z ^ (x & (y ^ z)))
#define F2(x, y, z)	F1(z, x, y)
#define F3(x, y, z)	(x ^ y ^ z)
#define F4(x, y, z)	(y ^ (x | ~z))

#define MD5STEP(f, w, x, y, z, in, s) \
	(w += f(x, y, z) + in, w = (w<<s | w>>(32-s)) + x)

struct fio_md5_ctx {
	uint32_t *hash;
	uint32_t block[MD5_BLOCK_WORDS];
	uint64_t byte_count;
};

extern void fio_md5_update(struct fio_md5_ctx *, const uint8_t *, unsigned int);
extern void fio_md5_final(struct fio_md5_ctx *);
extern void fio_md5_init(struct fio_md5_ctx *);

#endif