1727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease/*
2727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc.
3727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease * MD5 Message-Digest Algorithm (RFC 1321).
4727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease *
5727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease * Homepage:
6727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5
7727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease *
8727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease * Author:
9727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease * Alexander Peslyak, better known as Solar Designer <solar at openwall.com>
10727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease *
11727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease * This software was written by Alexander Peslyak in 2001.  No copyright is
12727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease * claimed, and the software is hereby placed in the public domain.
13727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease * In case this attempt to disclaim copyright and place the software in the
14727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease * public domain is deemed null and void, then the software is
15727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the
16727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease * general public under the following terms:
17727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease *
18727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease * Redistribution and use in source and binary forms, with or without
19727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease * modification, are permitted.
20727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease *
21727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease * There's ABSOLUTELY NO WARRANTY, express or implied.
22727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease *
23727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease * See md5.c for more information.
24727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease */
25727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease
26727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease#ifdef HAVE_OPENSSL
27727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease#include <openssl/md5.h>
28727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease#elif !defined(_MD5_H)
29727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease#define _MD5_H
30727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease
31727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease/* Any 32-bit or wider unsigned integer data type will do */
32727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Leasetypedef unsigned int MD5_u32plus;
33727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease
34727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Leasetypedef struct {
35727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease	MD5_u32plus lo, hi;
36727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease	MD5_u32plus a, b, c, d;
37727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease	unsigned char buffer[64];
38727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease	MD5_u32plus block[16];
39727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease} MD5_CTX;
40727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease
41727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Leaseextern void MD5_Init(MD5_CTX *ctx);
42ec0bab5697bb31ba980810145f62e3799946ec60Victoria Leaseextern void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size);
43727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Leaseextern void MD5_Final(unsigned char *result, MD5_CTX *ctx);
44727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease
45727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease#endif
46