Public Member Functions | |
NAbstractHash (void) | |
Constructs a NAbstractHash object. | |
virtual | ~NAbstractHash (void) |
Destroys a NAbstractHash object. | |
virtual NHash | calculate (const NString &str)=0 |
Calculates the hash of a given string. | |
virtual NHash | calculate (const NDataStream &data, nint32 size)=0 |
Calculates the hash of arbitrary data. | |
virtual NHash | calculateFile (const NString &filename)=0 |
Calculates the hash of a file. | |
virtual NHash | calculateFile (NFile *file)=0 |
Calculates the hash of a file. | |
bool | match (const NString &str, const NString &hash) |
Tests whether a string matches a given hash. | |
bool | match (const NString &str, const NHash &hash) |
Tests whether a string matches a given hash. | |
bool | match (NFile *file, const NString &hash) |
Tests whether a file matches a given hash. | |
bool | match (NFile *file, const NHash &hash) |
Tests whether a file matches a given hash. | |
Protected Member Functions | |
void | init (const NString &hash_name) |
Initialiazes the hash structures. | |
int | update (const void *data, int bytes) |
Updates the hash structures by computing the hash of more data. | |
NString | cleanup (void) |
Clear the hash structures and return the result. | |
void | setHashBufferSize (int size) |
Sets the size of the internal buffer used to calculate the hash. | |
int | getHashBufferSize (void) const |
Gets the size of the internal buffer used to calculate the hash. |
Definition at line 48 of file nabstracthash.h.
virtual NHash calculate | ( | const NDataStream & | data, | |
nint32 | size | |||
) | [pure virtual] |
Tests whether a string matches a given hash.
str | The string to be tested | |
hash | The hash to be tested in string format |
Definition at line 106 of file nabstracthash.cpp.
References calculate().
Tests whether a string matches a given hash.
str | The string to be tested | |
hash | The hash to be tested |
Definition at line 115 of file nabstracthash.cpp.
References calculate().
Tests whether a file matches a given hash.
file | A pointer to an open NFile object | |
hash | The hash to be tested in string format |
Definition at line 123 of file nabstracthash.cpp.
References calculateFile().
Tests whether a file matches a given hash.
file | A pointer to an open NFile object | |
hash | The hash to be tested |
Definition at line 134 of file nabstracthash.cpp.
References calculateFile().
void init | ( | const NString & | hash_name | ) | [protected] |
Initialiazes the hash structures.
hash_name | The name of the hash |
Definition at line 39 of file nabstracthash.cpp.
References NSTR(), NException::SECURITY, and NString::toChar().
Referenced by NMd2Hash::NMd2Hash(), NMd4Hash::NMd4Hash(), NMd5Hash::NMd5Hash(), NSha1Hash::NSha1Hash(), and NShaHash::NShaHash().
int update | ( | const void * | data, | |
int | bytes | |||
) | [protected] |
Updates the hash structures by computing the hash of more data.
data | The data to be computed | |
bytes | Number of bytes to compute |
Definition at line 55 of file nabstracthash.cpp.
Referenced by NShaHash::calculate(), NSha1Hash::calculate(), NMd5Hash::calculate(), NMd4Hash::calculate(), NMd2Hash::calculate(), NShaHash::calculateFile(), NSha1Hash::calculateFile(), NMd5Hash::calculateFile(), NMd4Hash::calculateFile(), and NMd2Hash::calculateFile().
NString cleanup | ( | void | ) | [protected] |
Clear the hash structures and return the result.
Definition at line 63 of file nabstracthash.cpp.
Referenced by NShaHash::calculate(), NSha1Hash::calculate(), NMd5Hash::calculate(), NMd4Hash::calculate(), NMd2Hash::calculate(), NShaHash::calculateFile(), NSha1Hash::calculateFile(), NMd5Hash::calculateFile(), NMd4Hash::calculateFile(), and NMd2Hash::calculateFile().
void setHashBufferSize | ( | int | size | ) | [protected] |
Sets the size of the internal buffer used to calculate the hash.
size | The size of the internal buffer |
Definition at line 145 of file nabstracthash.cpp.
Referenced by NMd2Hash::NMd2Hash(), NMd4Hash::NMd4Hash(), NMd5Hash::NMd5Hash(), NSha1Hash::NSha1Hash(), and NShaHash::NShaHash().
int getHashBufferSize | ( | void | ) | const [protected] |
Gets the size of the internal buffer used to calculate the hash.
Definition at line 150 of file nabstracthash.cpp.