md5.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9#ifndef SQUID_MD5_H
10#define SQUID_MD5_H
11
12#if HAVE_NETTLE_MD5_H
13#include <nettle/md5.h>
14
15typedef struct md5_ctx SquidMD5_CTX;
16
17#define SquidMD5Init(c) md5_init((c))
18#define SquidMD5Update(c,b,l) md5_update((c), (l), (const uint8_t *)(b))
19#define SquidMD5Final(d,c) md5_digest((c), MD5_DIGEST_SIZE, (uint8_t *)(d))
20
21#define SQUID_MD5_DIGEST_LENGTH MD5_DIGEST_SIZE
22
23#else
24/*
25 * This is the header file for the MD5 message-digest algorithm.
26 * The algorithm is due to Ron Rivest. This code was
27 * written by Colin Plumb in 1993, no copyright is claimed.
28 * This code is in the public domain; do with it what you wish.
29 *
30 * Equivalent code is available from RSA Data Security, Inc.
31 * This code has been tested against that, and is equivalent,
32 * except that you don't need to include two pages of legalese
33 * with every copy.
34 *
35 * To compute the message digest of a chunk of bytes, declare an
36 * MD5Context structure, pass it to MD5Init, call MD5Update as
37 * needed on buffers full of bytes, and then call MD5Final, which
38 * will fill a supplied 16-byte array with the digest.
39 *
40 * Changed so as no longer to depend on Colin Plumb's `usual.h'
41 * header definitions; now uses stuff from dpkg's config.h
42 * - Ian Jackson <ian@chiark.greenend.org.uk>.
43 * Still in the public domain.
44 *
45 * Changed MD5Update to take a void * for easier use and some other
46 * minor cleanup. - Henrik Nordstrom <henrik@henriknordstrom.net>.
47 * Still in the public domain.
48 *
49 * Prefixed all symbols with "Squid" so they don't collide with
50 * other libraries. Duane Wessels <wessels@squid-cache.org>.
51 * Still in the public domain.
52 *
53 */
54
55typedef struct SquidMD5Context {
56 uint32_t buf[4];
57 uint32_t bytes[2];
58 uint32_t in[16];
60
61SQUIDCEXTERN void SquidMD5Init(struct SquidMD5Context *context);
62SQUIDCEXTERN void SquidMD5Update(struct SquidMD5Context *context, const void *buf, unsigned len);
63SQUIDCEXTERN void SquidMD5Final(uint8_t digest[16], struct SquidMD5Context *context);
64SQUIDCEXTERN void SquidMD5Transform(uint32_t buf[4], uint32_t const in[16]);
65
66#define SQUID_MD5_DIGEST_LENGTH 16
67
68#endif /* HAVE_NETTLE_MD5_H */
69
70#endif /* SQUID_MD5_H */
71
SQUIDCEXTERN void SquidMD5Init(struct SquidMD5Context *context)
Definition: md5.c:73
SQUIDCEXTERN void SquidMD5Update(struct SquidMD5Context *context, const void *buf, unsigned len)
Definition: md5.c:89
SQUIDCEXTERN void SquidMD5Transform(uint32_t buf[4], uint32_t const in[16])
Definition: md5.c:181
SQUIDCEXTERN void SquidMD5Final(uint8_t digest[16], struct SquidMD5Context *context)
struct SquidMD5Context SquidMD5_CTX
#define SQUIDCEXTERN
Definition: squid.h:21
uint32_t bytes[2]
Definition: md5.h:57
uint32_t buf[4]
Definition: md5.h:56
uint32_t in[16]
Definition: md5.h:58

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors