Keep track of collisions. More...
Public Types | |
enum | Bits { Bits32 , Bits64 } |
The size of hash function being tested. More... | |
Public Member Functions | |
Collider (const std::string name, Hasher hash, const enum Bits bits) | |
Constructor. More... | |
bool | Add (const std::string phrase) |
Add a string to the Collider. More... | |
std::string | GetName () const |
void | Report () const |
Print the collisions found. More... | |
Public Attributes | |
Hasher | m_hash |
The hash. More... | |
std::string | m_name |
Name of this hash. More... | |
Private Types | |
typedef std::vector< std::pair< uint64_t, std::string > > | collision_t |
Collision map of subsequent instances. More... | |
typedef std::map< uint64_t, std::string > | hashdict_t |
Hashed dictionary of first instance of each hash. More... | |
Private Member Functions | |
uint64_t | GetHash (const std::string phrase) |
Get the appropriate hash value. More... | |
Private Attributes | |
enum Bits | m_bits |
Hash function. More... | |
collision_t | m_coll |
The list of collisions. More... | |
hashdict_t | m_dict |
The dictionary map, indexed by hash. More... | |
Keep track of collisions.
Definition at line 118 of file hash-example.cc.
|
private |
Collision map of subsequent instances.
Definition at line 258 of file hash-example.cc.
|
private |
Hashed dictionary of first instance of each hash.
Definition at line 252 of file hash-example.cc.
The size of hash function being tested.
Enumerator | |
---|---|
Bits32 | Use 32-bit hash function. |
Bits64 | Use 64-bit hash function. |
Definition at line 126 of file hash-example.cc.
|
inline |
Constructor.
Definition at line 139 of file hash-example.cc.
|
inline |
|
inlineprivate |
Get the appropriate hash value.
[in] | phrase | The string to hash. |
Definition at line 232 of file hash-example.cc.
References Bits32, ns3::Hasher::clear(), ns3::Hasher::GetHash32(), ns3::Hasher::GetHash64(), m_bits, and m_hash.
Referenced by Add().
|
inline |
Definition at line 188 of file hash-example.cc.
References Bits32, Bits64, m_bits, and m_name.
Referenced by Report(), and ns3::Hash::Example::Dictionary::TimeOne().
|
inline |
Print the collisions found.
Definition at line 204 of file hash-example.cc.
References GetName(), m_coll, and m_dict.
|
private |
Hash function.
Definition at line 232 of file hash-example.cc.
|
private |
The list of collisions.
Definition at line 261 of file hash-example.cc.
|
private |
The dictionary map, indexed by hash.
Definition at line 255 of file hash-example.cc.
Hasher ns3::Hash::Example::Collider::m_hash |
The hash.
Definition at line 123 of file hash-example.cc.
Referenced by GetHash(), and ns3::Hash::Example::Dictionary::TimeOne().
std::string ns3::Hash::Example::Collider::m_name |