Rhino C++ API  7.21
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
ON_MD5_Hash Class Reference

#include <opennurbs_md5.h>

Public Member Functions

 ON_MD5_Hash ()
 Default constructor is the zero digest hash. More...
 
 ON_MD5_Hash (const ON_MD5_Hash &)=default
 
 ~ON_MD5_Hash ()=default
 
void Dump (class ON_TextLog &text_log) const
 
ON_MD5_Hashoperator= (const ON_MD5_Hash &)=default
 
bool Read (class ON_BinaryArchive &archive)
 
const ON_wString ToString (bool bUpperCaseHexadecimalDigits) const
 
const ON_String ToUTF8String (bool bUpperCaseHexadecimalDigits) const
 
bool Write (class ON_BinaryArchive &archive) const
 

Static Public Member Functions

static ON_MD5_Hash BufferHash (const void *buffer, size_t sizeof_buffer)
 
static int Compare (const ON_MD5_Hash &a, const ON_MD5_Hash &b)
 
static ON_MD5_Hash FileHash (const char *filename, ON__UINT64 &sizeof_file)
 
static ON_MD5_Hash FileHash (const wchar_t *filename, ON__UINT64 &sizeof_file)
 
static ON_MD5_Hash FileHash (FILE *file, ON__UINT64 &sizeof_file)
 
static ON_MD5_Hash StringHash (const char *str, size_t str_length, ON__UINT64 &byte_count)
 
static ON_MD5_Hash StringHash (const ON_String &str, ON__UINT64 &byte_count)
 
static ON_MD5_Hash StringHash (const ON_wString &str, ON__UINT64 &byte_count)
 
static ON_MD5_Hash StringHash (const wchar_t *str, size_t str_length, ON__UINT64 &byte_count)
 

Public Attributes

ON__UINT8 m_digest [16]
 

Static Public Attributes

static const ON_MD5_Hash EmptyContentHash
 MD5 hash of zero bytes. More...
 
static const ON_MD5_Hash ZeroDigest
 all digest bytes are zero More...
 

Detailed Description

/ / Copyright (c) 1993-2015 Robert McNeel & Associates. All rights reserved. / OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert / McNeel & Associates. / / THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. / ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF / MERCHANTABILITY ARE HEREBY DISCLAIMED. /
/ For complete openNURBS copyright information see http://www.opennurbs.org. / ////////////////////////////////////////////////////////////// The ON_MD5 class is based on code that is modified from C code with the following copyright.

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_Hash() [1/2]

ON_MD5_Hash::ON_MD5_Hash ( )

Default constructor is the zero digest hash.

◆ ~ON_MD5_Hash()

ON_MD5_Hash::~ON_MD5_Hash ( )
default

◆ ON_MD5_Hash() [2/2]

ON_MD5_Hash::ON_MD5_Hash ( const ON_MD5_Hash )
default

Member Function Documentation

◆ BufferHash()

static ON_MD5_Hash ON_MD5_Hash::BufferHash ( const void *  buffer,
size_t  sizeof_buffer 
)
static

Parameters: buffer - [in] sizeof_buffer - [in] number of bytes in buffer Returns: MD5 hash of the buffer.

◆ Compare()

static int ON_MD5_Hash::Compare ( const ON_MD5_Hash a,
const ON_MD5_Hash b 
)
static

◆ Dump()

void ON_MD5_Hash::Dump ( class ON_TextLog text_log) const

◆ FileHash() [1/3]

static ON_MD5_Hash ON_MD5_Hash::FileHash ( const char *  filename,
ON__UINT64 sizeof_file 
)
static

◆ FileHash() [2/3]

static ON_MD5_Hash ON_MD5_Hash::FileHash ( const wchar_t *  filename,
ON__UINT64 sizeof_file 
)
static

Parameters: filename - [in] Name of file sizeof_file - [out] number of bytes in file Returns: MD5 hash of the buffer.

◆ FileHash() [3/3]

static ON_MD5_Hash ON_MD5_Hash::FileHash ( FILE *  file,
ON__UINT64 sizeof_file 
)
static

Parameters: file - [in] File stream from ON_FileStream::Open(...,L"rb"); sizeof_file - [out] number of bytes in file Returns: MD5 hash of the file stream from the current offset to the end of the file.

◆ operator=()

ON_MD5_Hash& ON_MD5_Hash::operator= ( const ON_MD5_Hash )
default

◆ Read()

bool ON_MD5_Hash::Read ( class ON_BinaryArchive archive)

◆ StringHash() [1/4]

static ON_MD5_Hash ON_MD5_Hash::StringHash ( const char *  str,
size_t  str_length,
ON__UINT64 byte_count 
)
static

◆ StringHash() [2/4]

static ON_MD5_Hash ON_MD5_Hash::StringHash ( const ON_String str,
ON__UINT64 byte_count 
)
static

Parameters: str - [in] byte_count - [out] number of bytes in the string. Returns: MD5 hash of the UTF-8 encoding of the string. (Platforms and endian independent.)

◆ StringHash() [3/4]

static ON_MD5_Hash ON_MD5_Hash::StringHash ( const ON_wString str,
ON__UINT64 byte_count 
)
static

Parameters: str - [in] string byte_count - [out] number of bytes in UTF-8 encoding of the string. Returns: MD5 hash of the UTF-8 encoding of the string. (Platforms and endian independent.)

◆ StringHash() [4/4]

static ON_MD5_Hash ON_MD5_Hash::StringHash ( const wchar_t *  str,
size_t  str_length,
ON__UINT64 byte_count 
)
static

◆ ToString()

const ON_wString ON_MD5_Hash::ToString ( bool  bUpperCaseHexadecimalDigits) const

Parameters: bUpperCaseHexadecimalDigits - [in] false - use 0-9, a-f true - use 0-9, A-F Returns: The MD5 hash value as a 32 hexadecimal digits. The first digit in the string is the hexadecimal value of m_digest[0].

◆ ToUTF8String()

const ON_String ON_MD5_Hash::ToUTF8String ( bool  bUpperCaseHexadecimalDigits) const

Parameters: bUpperCaseHexadecimalDigits - [in] false - use 0-9, a-f true - use 0-9, A-F Returns: The MD5 hash value as a 32 hexadecimal digits. The first digit in the string is the hexadecimal value of m_digest[0].

◆ Write()

bool ON_MD5_Hash::Write ( class ON_BinaryArchive archive) const

Member Data Documentation

◆ EmptyContentHash

const ON_MD5_Hash ON_MD5_Hash::EmptyContentHash
static

MD5 hash of zero bytes.

◆ m_digest

ON__UINT8 ON_MD5_Hash::m_digest[16]

◆ ZeroDigest

const ON_MD5_Hash ON_MD5_Hash::ZeroDigest
static

all digest bytes are zero