147be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org/*
247be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org * This is the header file for the MD5 message-digest algorithm.
347be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org * The algorithm is due to Ron Rivest.  This code was
447be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org * written by Colin Plumb in 1993, no copyright is claimed.
547be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org * This code is in the public domain; do with it what you wish.
647be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org *
747be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org * Equivalent code is available from RSA Data Security, Inc.
847be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org * This code has been tested against that, and is equivalent,
947be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org * except that you don't need to include two pages of legalese
1047be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org * with every copy.
1147be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org * To compute the message digest of a chunk of bytes, declare an
1247be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org * MD5Context structure, pass it to MD5Init, call MD5Update as
1347be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org * needed on buffers full of bytes, and then call MD5Final, which
1447be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org * will fill a supplied 16-byte array with the digest.
1547be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org *
1647be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org */
1747be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
1847be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org// Changes(fbarchard): Ported to C++ and Google style guide.
1947be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org// Made context first parameter in MD5Final for consistency with Sha1.
20b2eea5cf51211d6d4fd735380705f9626a1ebff9henrike@webrtc.org// Changes(hellner): added rtc namespace
2147be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
2247be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org#ifndef WEBRTC_BASE_MD5_H_
2347be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org#define WEBRTC_BASE_MD5_H_
2447be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
2547be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org#include "webrtc/base/basictypes.h"
2647be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
27b2eea5cf51211d6d4fd735380705f9626a1ebff9henrike@webrtc.orgnamespace rtc {
28b2eea5cf51211d6d4fd735380705f9626a1ebff9henrike@webrtc.org
2947be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org// Canonical name for a MD5 context structure, used in many crypto libs.
3047be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.orgtypedef struct MD5Context MD5_CTX;
3147be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
3247be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.orgstruct MD5Context {
3347be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org  uint32 buf[4];
3447be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org  uint32 bits[2];
3547be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org  uint32 in[16];
3647be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org};
3747be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
3847be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.orgvoid MD5Init(MD5Context* context);
3947be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.orgvoid MD5Update(MD5Context* context, const uint8* data, size_t len);
4047be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.orgvoid MD5Final(MD5Context* context, uint8 digest[16]);
4147be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.orgvoid MD5Transform(uint32 buf[4], const uint32 in[16]);
4247be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
43b2eea5cf51211d6d4fd735380705f9626a1ebff9henrike@webrtc.org}  // namespace rtc
44b2eea5cf51211d6d4fd735380705f9626a1ebff9henrike@webrtc.org
4547be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org#endif  // WEBRTC_BASE_MD5_H_
46