Rhino C++ API  8.6
Public Member Functions | Static Public Member Functions | List of all members
ON_SHA1 Class Reference

#include <opennurbs_sha1.h>

Public Member Functions

 ON_SHA1 ()=default
 
 ON_SHA1 (const ON_SHA1 &)=default
 
 ~ON_SHA1 ()=default
 
void Accumulate2dPoint (const class ON_2dPoint &point)
 
void Accumulate2dVector (const class ON_2dVector &vector)
 
void Accumulate2fPoint (const class ON_2fPoint &point)
 
void Accumulate2fVector (const class ON_2fVector &vector)
 
void Accumulate3dPoint (const class ON_3dPoint &point)
 
void Accumulate3dVector (const class ON_3dVector &vector)
 
void Accumulate3fPoint (const class ON_3fPoint &point)
 
void Accumulate3fVector (const class ON_3fVector &vector)
 
void Accumulate4dPoint (const class ON_4dPoint &point)
 
void Accumulate4fPoint (const class ON_4fPoint &point)
 
void AccumulateBool (bool b)
 
void AccumulateBoundingBox (const class ON_BoundingBox &bbox)
 
void AccumulateBytes (const void *buffer, ON__UINT64 sizeof_buffer)
 
void AccumulateDouble (double x)
 
void AccumulateDoubleArray (size_t count, const double *a)
 
void AccumulateFileReference (const class ON_FileReference &file_reference)
 
void AccumulateFloat (float x)
 
void AccumulateFloatArray (size_t count, const float *a)
 
void AccumulateId (const ON_UUID &id)
 
void AccumulateInteger16 (ON__INT16 i)
 
void AccumulateInteger32 (ON__INT32 i)
 
void AccumulateInteger32Array (size_t count, const ON__INT32 *a)
 
void AccumulateInteger64 (ON__INT64 i)
 
void AccumulateInteger8 (char i)
 
void AccumulateInteger8 (ON__INT8 i)
 
void AccumulateLengthUnitSystem (const ON::LengthUnitSystem length_unit_system)
 
void AccumulateString (const char *sUTF8, int element_count, ON_StringMapOrdinalType mapping)
 
void AccumulateString (const class ON_String &str)
 
void AccumulateString (const class ON_String &str, ON_StringMapOrdinalType mapping)
 
void AccumulateString (const class ON_wString &str)
 
void AccumulateString (const class ON_wString &str, ON_StringMapOrdinalType mapping)
 
void AccumulateString (const wchar_t *sUTF8, int element_count, ON_StringMapOrdinalType mapping)
 
void AccumulateSubHash (const class ON_SHA1_Hash &sub_hash)
 
void AccumulateTransformation (const class ON_Xform &xform)
 
void AccumulateUnitSystem (const class ON_UnitSystem &unit_system)
 
void AccumulateUnsigned16 (ON__UINT16 u)
 
void AccumulateUnsigned32 (ON__UINT32 u)
 
void AccumulateUnsigned64 (ON__UINT64 u)
 
void AccumulateUnsigned8 (ON__UINT8 u)
 
ON__UINT64 ByteCount () const
 
ON_SHA1_Hash Hash () const
 
ON_SHA1operator= (const ON_SHA1 &)=default
 
void Reset ()
 

Static Public Member Functions

static bool Validate ()
 

Detailed Description

Description: ON_SHA1 is a small class for calculating the SHA-1 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_SHA1 class cannot be used for cryptographic or security applications. The SHA-1 hash algorithm is not suitable for cryptographic or security applications. The ON_SHA1 class does not "wipe" intermediate results.

If you have two different sequences of N bytes storing information (lower entropy than a random sequence) are you are not intentionally calculating the information to create a SHA-1 hash collision, then the probability that the sequences have the same SHA-1 hash is approximately 2^-80 ~ 10^-24.

Constructor & Destructor Documentation

◆ ON_SHA1() [1/2]

ON_SHA1::ON_SHA1 ( )
default

◆ ~ON_SHA1()

ON_SHA1::~ON_SHA1 ( )
default

◆ ON_SHA1() [2/2]

ON_SHA1::ON_SHA1 ( const ON_SHA1 )
default

Member Function Documentation

◆ Accumulate2dPoint()

void ON_SHA1::Accumulate2dPoint ( const class ON_2dPoint point)

◆ Accumulate2dVector()

void ON_SHA1::Accumulate2dVector ( const class ON_2dVector vector)

◆ Accumulate2fPoint()

void ON_SHA1::Accumulate2fPoint ( const class ON_2fPoint point)

◆ Accumulate2fVector()

void ON_SHA1::Accumulate2fVector ( const class ON_2fVector vector)

◆ Accumulate3dPoint()

void ON_SHA1::Accumulate3dPoint ( const class ON_3dPoint point)

◆ Accumulate3dVector()

void ON_SHA1::Accumulate3dVector ( const class ON_3dVector vector)

◆ Accumulate3fPoint()

void ON_SHA1::Accumulate3fPoint ( const class ON_3fPoint point)

◆ Accumulate3fVector()

void ON_SHA1::Accumulate3fVector ( const class ON_3fVector vector)

◆ Accumulate4dPoint()

void ON_SHA1::Accumulate4dPoint ( const class ON_4dPoint point)

◆ Accumulate4fPoint()

void ON_SHA1::Accumulate4fPoint ( const class ON_4fPoint point)

◆ AccumulateBool()

void ON_SHA1::AccumulateBool ( bool  b)

◆ AccumulateBoundingBox()

void ON_SHA1::AccumulateBoundingBox ( const class ON_BoundingBox bbox)

◆ AccumulateBytes()

void ON_SHA1::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

◆ AccumulateDouble()

void ON_SHA1::AccumulateDouble ( double  x)

Description: Add the double value to the SHA1 in a manner that -0.0 and +0.0 will generate identical SHA-1 values and the result is independent of endian byte order.

◆ AccumulateDoubleArray()

void ON_SHA1::AccumulateDoubleArray ( size_t  count,
const double *  a 
)

Description: Add the double value to the SHA1 in a manner that -0.0 and +0.0 will generate identical SHA-1 values and the result is independent of endian byte order.

◆ AccumulateFileReference()

void ON_SHA1::AccumulateFileReference ( const class ON_FileReference file_reference)

Description: Accumuates the full and relative path names.

◆ AccumulateFloat()

void ON_SHA1::AccumulateFloat ( float  x)

Description: Add the double value to the SHA1 in a manner that -0.0 and +0.0 will generate identical SHA-1 values and the result is independent of endian byte order.

◆ AccumulateFloatArray()

void ON_SHA1::AccumulateFloatArray ( size_t  count,
const float *  a 
)

Description: Add the double value to the SHA1 in a manner that -0.0 and +0.0 will generate identical SHA-1 values and the result is independent of endian byte order.

◆ AccumulateId()

void ON_SHA1::AccumulateId ( const ON_UUID id)

◆ AccumulateInteger16()

void ON_SHA1::AccumulateInteger16 ( ON__INT16  i)

◆ AccumulateInteger32()

void ON_SHA1::AccumulateInteger32 ( ON__INT32  i)

◆ AccumulateInteger32Array()

void ON_SHA1::AccumulateInteger32Array ( size_t  count,
const ON__INT32 a 
)

◆ AccumulateInteger64()

void ON_SHA1::AccumulateInteger64 ( ON__INT64  i)

◆ AccumulateInteger8() [1/2]

void ON_SHA1::AccumulateInteger8 ( char  i)

◆ AccumulateInteger8() [2/2]

void ON_SHA1::AccumulateInteger8 ( ON__INT8  i)

◆ AccumulateLengthUnitSystem()

void ON_SHA1::AccumulateLengthUnitSystem ( const ON::LengthUnitSystem  length_unit_system)

◆ AccumulateString() [1/6]

void ON_SHA1::AccumulateString ( const char *  sUTF8,
int  element_count,
ON_StringMapOrdinalType  mapping 
)

◆ AccumulateString() [2/6]

void ON_SHA1::AccumulateString ( const class ON_String str)

◆ AccumulateString() [3/6]

void ON_SHA1::AccumulateString ( const class ON_String str,
ON_StringMapOrdinalType  mapping 
)

◆ AccumulateString() [4/6]

void ON_SHA1::AccumulateString ( const class ON_wString str)

◆ AccumulateString() [5/6]

void ON_SHA1::AccumulateString ( const class ON_wString str,
ON_StringMapOrdinalType  mapping 
)

◆ AccumulateString() [6/6]

void ON_SHA1::AccumulateString ( const wchar_t *  sUTF8,
int  element_count,
ON_StringMapOrdinalType  mapping 
)

◆ AccumulateSubHash()

void ON_SHA1::AccumulateSubHash ( const class ON_SHA1_Hash sub_hash)

◆ AccumulateTransformation()

void ON_SHA1::AccumulateTransformation ( const class ON_Xform xform)

◆ AccumulateUnitSystem()

void ON_SHA1::AccumulateUnitSystem ( const class ON_UnitSystem unit_system)

◆ AccumulateUnsigned16()

void ON_SHA1::AccumulateUnsigned16 ( ON__UINT16  u)

◆ AccumulateUnsigned32()

void ON_SHA1::AccumulateUnsigned32 ( ON__UINT32  u)

◆ AccumulateUnsigned64()

void ON_SHA1::AccumulateUnsigned64 ( ON__UINT64  u)

◆ AccumulateUnsigned8()

void ON_SHA1::AccumulateUnsigned8 ( ON__UINT8  u)

◆ ByteCount()

ON__UINT64 ON_SHA1::ByteCount ( ) const

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

◆ Hash()

ON_SHA1_Hash ON_SHA1::Hash ( ) const

Returns: SHA-1 hash value of the sequenence of ByteCount() bytes that have been passed to this ON_SHA1 classe's Update() function since construction or the last call to Reset(). Remarks: You may use Hash() to compute intermediate SHA-1 hash values.

Put another way, you may call Update() zero or more times passing in N1 bytes, call Digest() to get the SHA-1 hash of those N1 bytes, make zero or more additional calls to Update() passing in N2 additional bytes, call digest to get the SHA-1 hash of the sequence of (N1 + N2) bytes, and so on.

◆ operator=()

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

◆ Reset()

void ON_SHA1::Reset ( )

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

◆ Validate()

static bool ON_SHA1::Validate ( )
static

Description: This is a static function that uses ON_SHA1 to compute SHA-1 hash values of sequences of bytes with known SHA-1 hash values and compares the results from ON_SHA1 with the known SHA-1 hash values.

This function can be used to validate the ON_SHA1 class compiled correctly.

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