FreeTDS API
Loading...
Searching...
No Matches
md5.h
1#ifndef MD5_H
2#define MD5_H
3
4#ifndef HAVE_NETTLE
5
6#include <freetds/pushvis.h>
7
8struct MD5Context {
9 uint32_t buf[4];
10 uint64_t bytes;
11 uint32_t in[16];
12};
13
14void MD5Init(struct MD5Context *context);
15void MD5Update(struct MD5Context *context, const uint8_t *buf, size_t len);
16void MD5Final(struct MD5Context *context, uint8_t *digest);
17
18/*
19 * This is needed to make RSAREF happy on some MS-DOS compilers.
20 */
21typedef struct MD5Context MD5_CTX;
22
23#include <freetds/popvis.h>
24
25#else
26
27#include <nettle/md5.h>
28
29typedef struct md5_ctx MD5_CTX;
30
31static inline void MD5Init(MD5_CTX *ctx)
32{
33 nettle_md5_init(ctx);
34}
35
36static inline void MD5Update(MD5_CTX *ctx, const uint8_t *buf, size_t len)
37{
38 nettle_md5_update(ctx, len, buf);
39}
40
41static inline void MD5Final(MD5_CTX *ctx, uint8_t *digest)
42{
43 nettle_md5_digest(ctx, 16, digest);
44}
45
46#endif
47
48#endif /* !MD5_H */
Definition md5.h:8