Rudiments

Public Member Functions | List of all members
hash Class Referenceabstract

Inherited by md5, sha1, and sha256.

## Public Member Functions
| hash ()
virtual | ~hash ()
virtual bool | append (const unsigned char *data, uint32_t size)=0
virtual const unsigned char * | getHash ()=0
virtual uint64_t | getHashSize ()=0
virtual bool | clear ()=0
virtual hasherror_t | getError ()=0

## Detailed Description

The hash class provides a simple hash interface.

## Constructor & Destructor Documentation

## ◆ hash()

hash::hash | ( |  | ) |
| inline

Creates an instance of the hash class.

## ◆ ~hash()

virtual hash::~hash | ( |  | ) |
| inline virtual

Deletes this instance of the hash class.

## Member Function Documentation

## ◆ append()

virtual bool hash::append | ( | const unsigned char * | data,
|  | uint32_t | size
| ) |  |
| pure virtual

Appends "size" bytes of "data" to the data to be hashed. Returns true on success or false if an error occurred.

Implemented in sha256, sha1, and md5.

## ◆ clear()

virtual bool hash::clear | ( |  | ) |
| pure virtual

Clears the current hash and any data that had previously been appended. Returns true on success or false if an error occurred.

Implemented in sha256, sha1, and md5.

## ◆ getError()

virtual hasherror_t hash::getError | ( |  | ) |
| pure virtual

Returns the most recent error.

Implemented in sha256, sha1, and md5.

## ◆ getHash()

virtual const unsigned char* hash::getHash | ( |  | ) |
| pure virtual

Returns the current hash on success or NULL if an error occurred. Note that the current hash will be an empty string if no data has been appended yet.

Implemented in sha256, sha1, and md5.

## ◆ getHashSize()

virtual uint64_t hash::getHashSize | ( |  | ) |
| pure virtual

Returns the number of bytes in the hash.

Implemented in sha256, sha1, and md5.