#include <sha.h>
Inheritance diagram for SHA2:


Usage flow: SHA2() // construct a new SHA2 object add() // call as many times as necessary to process data final() // finalize message digest computation result() // obtain resulting hash value Recommendations for strict FIPS 140-1 compliance: All public data members and methods of the SHA2 class can be used by an application requiring FIPS 140-1 compliance.
Sample code illustrating the use of this class appears in the Cookbook section Using the Message Digest Functions.
Public Member Functions | |
| SHA2 (int version) | |
| Constructor used to create a new object initialized for SHA-256, -384 or -512. | |
| ~SHA2 () | |
| Destructor. Calls clear();. | |
| int | add (char c) |
| Update message digest computation with a single byte. | |
| int | add (int bytes, const char *buf) |
| Update message digest computation with a buffer. | |
| int | final (void) |
| Finalize the message digest computation. | |
| const char * | result (void) const |
| Get a pointer to the final message digest. | |
| int | length () const |
| Get the length in bytes of a message digest. | |
| int | blocksize () const |
| Get the algorithm block size. | |
| template<class T> | |
| T | to () const |
| Get a type T representation of the message digest. | |
| str | tostr () const |
| Get a str representation of the message digest. | |
| void | clear (void) |
| clear | |
| SHA2 | ( | int | version | ) | [inline, explicit] |
Constructor used to create a new object initialized for SHA-256, -384 or -512.
| version | indicator: 2 for SHA-256, 3 for SHA-384, 5 (or any other value) for SHA-512 |
| int add | ( | int | bytes, | |
| const char * | buf | |||
| ) |
Update message digest computation with a buffer.
| bytes | the number of bytes in the input buffer | |
| buf | a pointer to the input buffer |
| int add | ( | char | c | ) | [inline] |
Update message digest computation with a single byte.
| c | the byte to be hashed |
| int blocksize | ( | ) | const [inline] |
Get the algorithm block size.
| void clear | ( | void | ) |
| int final | ( | void | ) |
Finalize the message digest computation.
| int length | ( | ) | const |
Get the length in bytes of a message digest.
| const char* result | ( | void | ) | const |
Get a pointer to the final message digest.
| T to | ( | ) | const [inline] |
Get a type T representation of the message digest.
| str tostr | ( | ) | const |
Get a str representation of the message digest.
| ISC Cryptographic Development Kit - User's Guide | |
| Questions? E-mail ISC technical support | |
| Copyright© 2002-2006 Information Security Corp. All rights reserved. |