blob: dc0713c35195672962cc405be433acf81f74c348 [file] [log] [blame]
henrike@webrtc.orgf0488722014-05-13 18:00:26 +00001/*
2 * This is the header file for the MD5 message-digest algorithm.
3 * The algorithm is due to Ron Rivest. This code was
4 * written by Colin Plumb in 1993, no copyright is claimed.
5 * This code is in the public domain; do with it what you wish.
6 *
7 * Equivalent code is available from RSA Data Security, Inc.
8 * This code has been tested against that, and is equivalent,
9 * except that you don't need to include two pages of legalese
10 * with every copy.
11 * To compute the message digest of a chunk of bytes, declare an
12 * MD5Context structure, pass it to MD5Init, call MD5Update as
13 * needed on buffers full of bytes, and then call MD5Final, which
14 * will fill a supplied 16-byte array with the digest.
15 *
16 */
17
18// Changes(fbarchard): Ported to C++ and Google style guide.
19// Made context first parameter in MD5Final for consistency with Sha1.
henrike@webrtc.orgc50bf7c2014-05-14 18:24:13 +000020// Changes(hellner): added rtc namespace
Peter Boström0c4e06b2015-10-07 12:23:21 +020021// Changes(pbos): Reverted types back to uint32(8)_t with _t suffix.
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000022
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020023#ifndef RTC_BASE_MD5_H_
24#define RTC_BASE_MD5_H_
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000025
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +020026#include <stdint.h>
27#include <stdlib.h>
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000028
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +020029namespace rtc {
30
31struct MD5Context {
32 uint32_t buf[4];
33 uint32_t bits[2];
34 uint32_t in[16];
35};
36
37void MD5Init(MD5Context* context);
38void MD5Update(MD5Context* context, const uint8_t* data, size_t len);
39void MD5Final(MD5Context* context, uint8_t digest[16]);
40void MD5Transform(uint32_t buf[4], const uint32_t in[16]);
41
42} // namespace rtc
henrike@webrtc.orgc50bf7c2014-05-14 18:24:13 +000043
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020044#endif // RTC_BASE_MD5_H_