Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

md5.cpp File Reference


Detailed Description

MD5 source.

Author:
David Ameller <nail@menta.net>
Copyright
Copyright (C) 2002-2004 David Ameller
All trademarks are property of their respective owner.
License
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Note:
This code implements the MD5 message-digest algorithm. The algorithm is due to Ron Rivest. This code was written by Colin Plumb in 1993, no copyright is claimed.

This code is in the public domain; do with it what you wish. Equivalent code is available from RSA Data Security, Inc. This code has been tested against that, and is equivalent, except that you don't need to include two pages of legalese with every copy.

To compute the message digest of a chunk of bytes, declare an MD5Context structure, pass it to MD5Init, call MD5Update as needed on buffers full of bytes, and then call MD5Final, which will fill a supplied 16-byte array with the digest.

#include "stdafx.h"
#include "md5.h"
#include "strmanip.h"

Include dependency graph for md5.cpp:

Include dependency graph

Defines

#define F1(x, y, z)   (z^(x&(y^z)))
 The four core functions.

#define F2(x, y, z)   F1(z, x, y)
 The four core functions.

#define F3(x, y, z)   (x^y^z)
 The four core functions.

#define F4(x, y, z)   (y^(x|~z))
 The four core functions.

#define MD5STEP(f, w, x, y, z, data, s)   (w+=f(x, y, z)+data, w=w<<s|w>>(32-s), w+=x)
 This is the central step in the MD5 algorithm.


Define Documentation

#define F1 x,
y,
 )     (z^(x&(y^z)))
 

The four core functions.

Note:
F1 is optimized somewhat. #define F1(x, y, z) (x & y | ~x & z)

#define F2 x,
y,
 )     F1(z, x, y)
 

The four core functions.

#define F3 x,
y,
 )     (x^y^z)
 

The four core functions.

#define F4 x,
y,
 )     (y^(x|~z))
 

The four core functions.

#define MD5STEP f,
w,
x,
y,
z,
data,
 )     (w+=f(x, y, z)+data, w=w<<s|w>>(32-s), w+=x)
 

This is the central step in the MD5 algorithm.


doxygen sourceforge id3lib