]> the.earth.li Git - onak.git/blob - md5.h
Bump debhelper compat level to 13
[onak.git] / md5.h
1 /* Declaration of functions and data types used for MD5 sum computing
2    library functions.
3    Copyright (C) 1995,1996,1997,1999,2000,2001 Free Software Foundation, Inc.
4    This file is part of the GNU C Library.
5
6    The GNU C Library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public
8    License as published by the Free Software Foundation; either
9    version 2.1 of the License, or (at your option) any later version.
10
11    The GNU C Library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
15
16    You should have received a copy of the GNU Lesser General Public
17    License along with the GNU C Library; if not, write to the Free
18    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19    02111-1307 USA.  */
20
21 #ifndef _MD5_H
22 #define _MD5_H 1
23
24 #include <stdio.h>
25 #include <stdint.h>
26 #include <sys/types.h>
27 typedef size_t md5_uintptr;
28
29 /* Length in bytes of the MD5 digest */
30 #define MD5_DIGEST_SIZE 16
31
32 /* Structure to save state of computation between the single steps.  */
33 struct md5_ctx
34 {
35   char buffer[128];
36   uint32_t A;
37   uint32_t B;
38   uint32_t C;
39   uint32_t D;
40
41   uint32_t total[2];
42   uint32_t buflen;
43 };
44
45 /*
46  * The following three functions are build up the low level used in
47  * the functions `md5_stream' and `md5_buffer'.
48  */
49
50 /* Initialize structure containing state of computation.
51    (RFC 1321, 3.3: Step 3)  */
52 extern void md5_init(struct md5_ctx *ctx);
53
54 /* Starting with the result of former calls of this function (or the
55    initialization function update the context for the next LEN bytes
56    starting at BUFFER.
57    It is NOT required that LEN is a multiple of 64.  */
58 extern void md5_update(struct md5_ctx *ctx, unsigned length,
59                 const uint8_t *buffer);
60
61 /* Process the remaining bytes in the buffer and put result from CTX
62    in first 16 bytes following RESBUF.  The result is always in little
63    endian byte order, so that a byte-wise output yields to the wanted
64    ASCII representation of the message digest.
65
66    IMPORTANT: On some systems it is required that RESBUF is correctly
67    aligned for a 32 bits value.  */
68 extern void md5_digest(struct md5_ctx *ctx, unsigned length, uint8_t *resbuf);
69
70 #endif /* md5.h */