#include <SHA1.h>
Classes | |
struct | HashVal |
Public Types | |
enum | { BlockSize = 512 / 8, HashBytes = 20 } |
split into 64 byte blocks (=> 512 bits), hash is 20 bytes long More... | |
Public Member Functions | |
SHA1 () | |
same as reset() More... | |
Utf8String | operator() (const void *data, size_t numBytes) |
compute SHA1 of a memory block More... | |
Utf8String | operator() (Utf8StringCR text) |
compute SHA1 of a string, excluding final zero More... | |
void | Add (const void *data, size_t numBytes) |
add arbitrary number of bytes More... | |
Utf8String | GetHashString () |
return latest hash as 40 hex characters More... | |
HashVal | GetHashVal () |
return latest hash as 20 bytes More... | |
void | Reset () |
restart More... | |
compute SHA1 hash
Usage: SHA1 sha1; Utf8String myHash = sha1("Hello World"); // Utf8String Utf8String myHash2 = sha1("How are you", 11); // arbitrary data, 11 bytes
or in a streaming fashion:
SHA1 sha1; while (more data available) sha1.Add(pointer to fresh data, number of new bytes); Utf8String myHash3 = sha1.getHash();
anonymous enum |
SHA1 | ( | ) |
same as reset()
void Add | ( | const void * | data, |
size_t | numBytes | ||
) |
add arbitrary number of bytes
Utf8String GetHashString | ( | ) |
return latest hash as 40 hex characters
HashVal GetHashVal | ( | ) |
return latest hash as 20 bytes
Utf8String operator() | ( | const void * | data, |
size_t | numBytes | ||
) |
compute SHA1 of a memory block
Utf8String operator() | ( | Utf8StringCR | text | ) |
compute SHA1 of a string, excluding final zero
void Reset | ( | ) |
restart