This class implements the Secure Hashing Standard as defined in FIPS PUB 180-1 published April 17, 1995.
More...
Public Member Functions |
void | Reset () |
| Initializes the class member variables in preparation for computing a new message digest.
|
bool | Result (unsigned *message_digest_array) |
| Retrieves the 160-bit message digest.
|
void | Input (const unsigned char *message_array, unsigned length) |
| Append data to the the message.
|
void | Input (const char *message_array, unsigned length) |
| Append data to the the message.
|
void | Input (unsigned char message_element) |
| Append data to the the message.
|
void | Input (char message_element) |
| Append data to the the message.
|
SHA1 & | operator<< (const char *message_array) |
| Convenience operator for appending string data to the the message.
|
SHA1 & | operator<< (const unsigned char *message_array) |
| Convenience operator for appending string data to the the message.
|
SHA1 & | operator<< (const char message_element) |
| Convenience operator for appending character data to the the message.
|
SHA1 & | operator<< (const unsigned char message_element) |
| Convenience operator for appending octet data to the the message.
|
This class implements the Secure Hashing Standard as defined in FIPS PUB 180-1 published April 17, 1995.
The Secure Hashing Standard, which uses the Secure Hashing Algorithm (SHA), produces a 160-bit message digest for a given data stream. In theory, it is highly improbable that two messages will produce the same message digest. Therefore, this algorithm can serve as a means of providing a "fingerprint" for a message.
Portability Issues
SHA-1 is defined in terms of 32-bit "words". This code was written with the expectation that the processor has at least a 32-bit machine word size. If the machine word size is larger, the code should still function properly. One caveat to that is that the input functions taking characters and character arrays assume that only 8 bits of information are stored in each character.
Caveats
SHA-1 is designed to work with messages less than 2^64 bits long. Although SHA-1 allows a message digest to be generated for messages of any number of bits less than 2^64, this implementation only works with messages with a length that is a multiple of 8 bits.
- Examples:
-
ehs_wsgate.cpp.