Phoenix
Object-oriented orthogonally persistent operating system
|
This class is the primary tool for calculating lookup (non-cryptographic) hashes in Phoenix. More...
#include <hash.h>
Public Member Functions | |
Hash (u32 initial=0) | |
Create hash object. | |
void | Reset (u32 initial=0) |
Reset the calculator state to the initial one. | |
void | Feed (const void *data, size_t size) |
Feed input data to hash calculator. | |
u32 | Get32 () |
Get 32-bits hash value based on data fed so far. | |
u64 | Get64 () |
Get 64-bits hash value based on data fed so far. | |
operator u32 () | |
Get 32-bits hash value based on data fed so far. | |
operator u64 () | |
Get 64-bits hash value based on data fed so far. | |
size_t | GetLength () |
Get total length of data fed to the calculator input so far. | |
Static Public Member Functions | |
static void | Mix (u32 &a, u32 &b, u32 &c) |
Apply hash reversible mix operation to three 32-bits words. | |
static void | Final (u32 &a, u32 &b, u32 &c) |
Final mixing of three 32-bits words. |
This class is the primary tool for calculating lookup (non-cryptographic) hashes in Phoenix.
It is based on Bob Jenkins hash algorithm (lookup3).
Hash::Hash | ( | u32 | initial = 0 | ) | [inline] |
Create hash object.
initial | Initial value for a hash. It can be used as salt. |
void Hash::Feed | ( | const void * | data, |
size_t | size | ||
) |
Final mixing of three 32-bits words.
a | The first word. |
b | The second word. |
c | The third word. Result is returned in this argument. |
u32 Hash::Get32 | ( | ) | [inline] |
Get 32-bits hash value based on data fed so far.
u64 Hash::Get64 | ( | ) | [inline] |
Get 64-bits hash value based on data fed so far.
size_t Hash::GetLength | ( | ) | [inline] |
Get total length of data fed to the calculator input so far.
Apply hash reversible mix operation to three 32-bits words.
a | The first word. |
b | The second word. |
c | The third word. |
Hash::operator u32 | ( | ) | [inline] |
Get 32-bits hash value based on data fed so far.
This operation is not destructive - data still can be fed on input to get hash values incrementally.
Hash::operator u64 | ( | ) | [inline] |
Get 64-bits hash value based on data fed so far.
void Hash::Reset | ( | u32 | initial = 0 | ) | [inline] |
Reset the calculator state to the initial one.
initial | Initial value for a hash. It can be used as salt. |