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). More...
#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 | Accumulate3dPoint (const class ON_3dPoint &point) |
void | Accumulate3dVector (const class ON_3dVector &vector) |
void | Accumulate4dPoint (const class ON_4dPoint &point) |
void | AccumulateBool (bool b) |
void | AccumulateBoundingBox (const class ON_BoundingBox &bbox) |
void | AccumulateBytes (const void *buffer, ON__UINT64 sizeof_buffer) |
Make one or more calls to AccumulateBytes() as the sequenence of bytes is available. More... | |
void | AccumulateDouble (double x) |
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. More... | |
void | AccumulateDoubleArray (size_t count, const double *a) |
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. More... | |
void | AccumulateFileReference (const class ON_FileReference &file_reference) |
Accumuates the full and relative path names. More... | |
void | AccumulateId (const ON_UUID &id) |
void | AccumulateInteger16 (ON__INT16 i) |
void | AccumulateInteger32 (ON__INT32 i) |
void | AccumulateInteger64 (ON__INT64 i) |
void | AccumulateInteger8 (ON__INT8 i) |
void | AccumulateLengthUnitSystem (const ON::LengthUnitSystem length_unit_system) |
void | AccumulateString (const class ON_String &str) |
void | AccumulateString (const class ON_wString &str) |
void | AccumulateString (const char *sUTF8, int element_count, ON_StringMapOrdinalType mapping) |
void | AccumulateString (const wchar_t *sUTF8, int element_count, ON_StringMapOrdinalType mapping) |
void | AccumulateString (const class ON_String &str, ON_StringMapOrdinalType mapping) |
void | AccumulateString (const class ON_wString &str, 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_SHA1 & | operator= (const ON_SHA1 &)=default |
void | Reset () |
Reset this ON_SHA1 class so it can be reused. More... | |
Static Public Member Functions | |
static bool | Validate () |
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. More... | |
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).
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 seqences 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.
|
default |
|
default |
|
default |
void ON_SHA1::Accumulate2dPoint | ( | const class ON_2dPoint & | point | ) |
void ON_SHA1::Accumulate2dVector | ( | const class ON_2dVector & | vector | ) |
void ON_SHA1::Accumulate3dPoint | ( | const class ON_3dPoint & | point | ) |
void ON_SHA1::Accumulate3dVector | ( | const class ON_3dVector & | vector | ) |
void ON_SHA1::Accumulate4dPoint | ( | const class ON_4dPoint & | point | ) |
void ON_SHA1::AccumulateBool | ( | bool | b | ) |
void ON_SHA1::AccumulateBoundingBox | ( | const class ON_BoundingBox & | bbox | ) |
void ON_SHA1::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 |
void ON_SHA1::AccumulateDouble | ( | double | x | ) |
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.
void ON_SHA1::AccumulateDoubleArray | ( | size_t | count, |
const double * | a | ||
) |
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.
void ON_SHA1::AccumulateFileReference | ( | const class ON_FileReference & | file_reference | ) |
Accumuates the full and relative path names.
void ON_SHA1::AccumulateId | ( | const ON_UUID & | id | ) |
void ON_SHA1::AccumulateInteger16 | ( | ON__INT16 | i | ) |
void ON_SHA1::AccumulateInteger32 | ( | ON__INT32 | i | ) |
void ON_SHA1::AccumulateInteger64 | ( | ON__INT64 | i | ) |
void ON_SHA1::AccumulateInteger8 | ( | ON__INT8 | i | ) |
void ON_SHA1::AccumulateLengthUnitSystem | ( | const ON::LengthUnitSystem | length_unit_system | ) |
void ON_SHA1::AccumulateString | ( | const class ON_String & | str | ) |
void ON_SHA1::AccumulateString | ( | const class ON_wString & | str | ) |
void ON_SHA1::AccumulateString | ( | const char * | sUTF8, |
int | element_count, | ||
ON_StringMapOrdinalType | mapping | ||
) |
void ON_SHA1::AccumulateString | ( | const wchar_t * | sUTF8, |
int | element_count, | ||
ON_StringMapOrdinalType | mapping | ||
) |
void ON_SHA1::AccumulateString | ( | const class ON_String & | str, |
ON_StringMapOrdinalType | mapping | ||
) |
void ON_SHA1::AccumulateString | ( | const class ON_wString & | str, |
ON_StringMapOrdinalType | mapping | ||
) |
void ON_SHA1::AccumulateSubHash | ( | const class ON_SHA1_Hash & | sub_hash | ) |
void ON_SHA1::AccumulateTransformation | ( | const class ON_Xform & | xform | ) |
void ON_SHA1::AccumulateUnitSystem | ( | const class ON_UnitSystem & | unit_system | ) |
void ON_SHA1::AccumulateUnsigned16 | ( | ON__UINT16 | u | ) |
void ON_SHA1::AccumulateUnsigned32 | ( | ON__UINT32 | u | ) |
void ON_SHA1::AccumulateUnsigned64 | ( | ON__UINT64 | u | ) |
void ON_SHA1::AccumulateUnsigned8 | ( | ON__UINT8 | u | ) |
ON__UINT64 ON_SHA1::ByteCount | ( | ) | const |
ON_SHA1_Hash ON_SHA1::Hash | ( | ) | const |
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 seqence of (N1 + N2) bytes, and so on.
void ON_SHA1::Reset | ( | ) |
Reset this ON_SHA1 class so it can be reused.
|
static |
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.