ON_MD5 is a small class for calculating the MD5 hash of a sequence of bytes. It may be use incrementally (the bytes do not have to be in a contiguous array in memory at one time). More...
#include <opennurbs_md5.h>
Public Member Functions | |
ON_MD5 ()=default | |
ON_MD5 (const ON_MD5 &)=default | |
~ON_MD5 ()=default | |
void | AccumulateBytes (const void *buffer, ON__UINT64 sizeof_buffer) |
Make one or more calls to AccumulateBytes() as the sequenence of bytes is available. More... | |
ON__UINT64 | ByteCount () const |
ON_MD5_Hash | Hash () const |
ON_MD5 & | operator= (const ON_MD5 &)=default |
void | Reset () |
Reset this ON_MD5 class so it can be reused. More... | |
Static Public Member Functions | |
static bool | Validate () |
This is a static function that uses ON_MD5 to compute MD5 hash values of sequences of bytes with known MD5 hash values and compares the results from ON_SHA1 with the known MD5 hash values. More... | |
ON_MD5 is a small class for calculating the MD5 hash of a sequence of bytes. It may be use incrementally (the bytes do not have to be in a contiguous array in memory at one time).
The ON_MD5 class cannot be used for cryptographic or security applications. The MD5 hash algorithm is not suitable for cryptographic or security applications. The ON_MD5 class does not "wipe" intermediate results.
The probability of two different randomly selected seqences of N bytes to have the same value MD5 hash depends on N, but it is roughly 2^-64 ~ 10^-19.
MD5 hash values are 16 bytes. SHA-1 hash values are 20 bytes. If you need a hash and have room for 20 bytes, then ON_SHA1 is preferred over ON_MD5.
Legal: Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved.
License to copy and use this software is granted provided that it is identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing this software or this function.
License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing the derived work.
RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this documentation and/or software.
|
default |
|
default |
|
default |
void ON_MD5::AccumulateBytes | ( | const void * | buffer, |
ON__UINT64 | sizeof_buffer | ||
) |
Make one or more calls to AccumulateBytes() as the sequenence of bytes is available.
buffer | [in] |
sizeof_buffer | [in] number of bytes in buffer |
ON__UINT64 ON_MD5::ByteCount | ( | ) | const |
ON_MD5_Hash ON_MD5::Hash | ( | ) | const |
You may use Hash() to compute intermediate MD5 hash values.
Put another way, you may call Update() zero or more times passing in N1 bytes, call Digest() to get the MD5 hash of those N1 bytes, make zero or more additional calls to Update() passing in N2 additional bytes, call digest to get the MD5 hash of the seqence of (N1 + N2) bytes, and so on.
void ON_MD5::Reset | ( | ) |
Reset this ON_MD5 class so it can be reused.
|
static |
This is a static function that uses ON_MD5 to compute MD5 hash values of sequences of bytes with known MD5 hash values and compares the results from ON_SHA1 with the known MD5 hash values.
This function can be used to validate the ON_MD5 class compiled correctly.