xref: /aosp_15_r20/external/libjpeg-turbo/md5/md5.h (revision dfc6aa5c1cfd4bc4e2018dc74aa96e29ee49c6da)
1*dfc6aa5cSAndroid Build Coastguard Worker /*
2*dfc6aa5cSAndroid Build Coastguard Worker  * libjpeg-turbo Modifications:
3*dfc6aa5cSAndroid Build Coastguard Worker  * Copyright (C)2018 D. R. Commander.  All Rights Reserved.
4*dfc6aa5cSAndroid Build Coastguard Worker  *
5*dfc6aa5cSAndroid Build Coastguard Worker  * Redistribution and use in source and binary forms, with or without
6*dfc6aa5cSAndroid Build Coastguard Worker  * modification, are permitted provided that the following conditions are met:
7*dfc6aa5cSAndroid Build Coastguard Worker  *
8*dfc6aa5cSAndroid Build Coastguard Worker  * - Redistributions of source code must retain the above copyright notice,
9*dfc6aa5cSAndroid Build Coastguard Worker  *   this list of conditions and the following disclaimer.
10*dfc6aa5cSAndroid Build Coastguard Worker  * - Redistributions in binary form must reproduce the above copyright notice,
11*dfc6aa5cSAndroid Build Coastguard Worker  *   this list of conditions and the following disclaimer in the documentation
12*dfc6aa5cSAndroid Build Coastguard Worker  *   and/or other materials provided with the distribution.
13*dfc6aa5cSAndroid Build Coastguard Worker  * - Neither the name of the libjpeg-turbo Project nor the names of its
14*dfc6aa5cSAndroid Build Coastguard Worker  *   contributors may be used to endorse or promote products derived from this
15*dfc6aa5cSAndroid Build Coastguard Worker  *   software without specific prior written permission.
16*dfc6aa5cSAndroid Build Coastguard Worker  *
17*dfc6aa5cSAndroid Build Coastguard Worker  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
18*dfc6aa5cSAndroid Build Coastguard Worker  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19*dfc6aa5cSAndroid Build Coastguard Worker  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20*dfc6aa5cSAndroid Build Coastguard Worker  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
21*dfc6aa5cSAndroid Build Coastguard Worker  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22*dfc6aa5cSAndroid Build Coastguard Worker  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23*dfc6aa5cSAndroid Build Coastguard Worker  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24*dfc6aa5cSAndroid Build Coastguard Worker  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25*dfc6aa5cSAndroid Build Coastguard Worker  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26*dfc6aa5cSAndroid Build Coastguard Worker  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27*dfc6aa5cSAndroid Build Coastguard Worker  * POSSIBILITY OF SUCH DAMAGE.
28*dfc6aa5cSAndroid Build Coastguard Worker  */
29*dfc6aa5cSAndroid Build Coastguard Worker 
30*dfc6aa5cSAndroid Build Coastguard Worker #ifndef MD5_H
31*dfc6aa5cSAndroid Build Coastguard Worker #define MD5_H
32*dfc6aa5cSAndroid Build Coastguard Worker 
33*dfc6aa5cSAndroid Build Coastguard Worker #include <sys/types.h>
34*dfc6aa5cSAndroid Build Coastguard Worker #ifdef __amigaos4__
35*dfc6aa5cSAndroid Build Coastguard Worker #include <machine/endian.h>
36*dfc6aa5cSAndroid Build Coastguard Worker #endif
37*dfc6aa5cSAndroid Build Coastguard Worker 
38*dfc6aa5cSAndroid Build Coastguard Worker /*  On machines where "long" is 64 bits, we need to declare
39*dfc6aa5cSAndroid Build Coastguard Worker     uint32 as something guaranteed to be 32 bits.  */
40*dfc6aa5cSAndroid Build Coastguard Worker 
41*dfc6aa5cSAndroid Build Coastguard Worker typedef unsigned int uint32;
42*dfc6aa5cSAndroid Build Coastguard Worker 
43*dfc6aa5cSAndroid Build Coastguard Worker typedef struct MD5Context {
44*dfc6aa5cSAndroid Build Coastguard Worker   uint32 buf[4];
45*dfc6aa5cSAndroid Build Coastguard Worker   uint32 bits[2];
46*dfc6aa5cSAndroid Build Coastguard Worker   unsigned char in[64];
47*dfc6aa5cSAndroid Build Coastguard Worker } MD5_CTX;
48*dfc6aa5cSAndroid Build Coastguard Worker 
49*dfc6aa5cSAndroid Build Coastguard Worker extern void MD5Init(struct MD5Context *ctx);
50*dfc6aa5cSAndroid Build Coastguard Worker extern void MD5Update(struct MD5Context *ctx, unsigned char *buf,
51*dfc6aa5cSAndroid Build Coastguard Worker                       unsigned int len);
52*dfc6aa5cSAndroid Build Coastguard Worker extern void MD5Final(unsigned char digest[16], struct MD5Context *ctx);
53*dfc6aa5cSAndroid Build Coastguard Worker extern void MD5Transform(uint32 buf[4], uint32 in[16]);
54*dfc6aa5cSAndroid Build Coastguard Worker extern char *MD5File(const char *, char *);
55*dfc6aa5cSAndroid Build Coastguard Worker extern char *MD5FileChunk(const char *, char *, off_t, off_t);
56*dfc6aa5cSAndroid Build Coastguard Worker 
57*dfc6aa5cSAndroid Build Coastguard Worker #endif /* !MD5_H */
58