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


Usage flow: SHA() // construct a new SHA 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: As long as you do not use SHA-0, all public data members and methods of class SHA 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 | |
| SHA (int version=1) | |
| Constructor used to create an initialized SHA object for SHA (i.e., SHA-0) or SHA-1. | |
| ~SHA () | |
| 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 | add (int nbits, int b) |
| Update message digest computation with a specified number of bits. | |
| int | final (void) |
| Finalize the message digest computation. | |
| void | finalstore (void) |
| finalstore: | |
| 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. | |
| double | count64 () const |
| Get the number of bytes hashed so far. | |
| 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 | reset (int version=1) |
| Reset this SHA object. Calls clear(). | |
| void | resetk (void) |
| resetk: | |
| void | clear (void) |
| Clear this object, zeroizing and/or reinitializing all internal data. | |
| SHA | ( | int | version = 1 |
) | [inline, explicit] |
Constructor used to create an initialized SHA object for SHA (i.e., SHA-0) or SHA-1.
| version | indicator: 0 for SHA-0, 1 for SHA-1 |
| int add | ( | int | nbits, | |
| int | b | |||
| ) |
Update message digest computation with a specified number of bits.
| nbits | the number of bits in b to be hashed | |
| b | an int containing the bits to be hashed |
| 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 | ) |
Update message digest computation with a single byte.
| c | the byte to be hashed |
| int blocksize | ( | ) | const [inline] |
Get the algorithm block size.
| double count64 | ( | ) | const [inline] |
Get the number of bytes hashed so far.
| int final | ( | void | ) |
Finalize the message digest computation.
| void finalstore | ( | void | ) |
finalstore:
| int length | ( | ) | const [inline] |
Get the length in bytes of a message digest.
| void reset | ( | int | version = 1 |
) |
Reset this SHA object. Calls clear().
| version | indicates which version of SHA to perform: <= 0 for SHA, >= 1 for SHA-1 |
| void resetk | ( | void | ) |
resetk:
| 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. |