Rhino C++ API  8.7
Public Member Functions | Static Public Member Functions | List of all members
ON_MD5 Class Reference

#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)
ON__UINT64 ByteCount () const
ON_MD5_Hash Hash () const
ON_MD5operator= (const ON_MD5 &)=default
void Reset ()

Static Public Member Functions

static bool Validate ()

Detailed Description

Description: 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).

Remarks: 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 sequences 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.

Constructor & Destructor Documentation

◆ ON_MD5() [1/2]

ON_MD5::ON_MD5 ( )

◆ ~ON_MD5()

ON_MD5::~ON_MD5 ( )

◆ ON_MD5() [2/2]

ON_MD5::ON_MD5 ( const ON_MD5 )

Member Function Documentation

◆ AccumulateBytes()

void ON_MD5::AccumulateBytes ( const void *  buffer,
ON__UINT64  sizeof_buffer 

Description: Make one or more calls to AccumulateBytes() as the sequenence of bytes is available. Parameters: buffer - [in] sizeof_buffer - [in] number of bytes in buffer

◆ ByteCount()

ON__UINT64 ON_MD5::ByteCount ( ) const

Returns: Total number of bytes passed to Update().

◆ Hash()

ON_MD5_Hash ON_MD5::Hash ( ) const

Returns: MD5 hash value of the sequenence of ByteCount() bytes that have been passed to this ON_MD5 classe's Update() function since construction or the last call to Reset(). Remarks: 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 sequence of (N1 + N2) bytes, and so on.

◆ operator=()

ON_MD5& ON_MD5::operator= ( const ON_MD5 )

◆ Reset()

void ON_MD5::Reset ( )

Description: Reset this ON_MD5 class so it can be reused.

◆ Validate()

static bool ON_MD5::Validate ( )

Description: 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.

Returns: true All validation tests passed. false At least one validation test failed.