A Discrete-Event Network Simulator
API
Hash Functions

Generic Hash function interface. More...

+ Collaboration diagram for Hash Functions:

Modules

 FNV Hash Implementation
 
 Hash test suite
 
 Murmur3 Hash Implementation
 

Files

file  hash-example.cc
 Example usage of ns3::Hash.
 
file  hash-fnv.cc
 ns3::Hash::Function::Fnv1a implementation.
 
file  hash-fnv.h
 ns3::Hash::Function::Fnv1a declaration.
 
file  hash-function.cc
 ns3::Hash::Implementation::GetHash64 defaul implementation.
 
file  hash-function.h
 ns3::Hash::Implementation, ns3::Hash::Function::Hash32 and ns3::Hash::Function::Hash64 declarations.
 
file  hash-murmur3.cc
 ns3::Hash::Function::Murmur3 implementation.
 
file  hash-murmur3.h
 ns3::Hash::Function::Murmur3 declaration.
 
file  hash-test-suite.cc
 Hash test suite.
 
file  hash.cc
 ns3::Hasher implementation.
 
file  hash.h
 ns3::Hasher, ns3::Hash32() and ns3::Hash64() function declarations.
 

Namespaces

 ns3::Hash
 Hash function implementations.
 
 ns3::Hash::Example
 Namespace for hasher-example.
 
 ns3::Hash::Function
 Hash functions.
 

Classes

class  ns3::Hash::Example::Collider
 Keep track of collisions. More...
 
class  ns3::Hash::Example::DictFiles
 Source word list files. More...
 
class  ns3::Hash::Example::Dictionary
 Word list and hashers to test. More...
 
class  ns3::Hash::Function::Fnv1a
 Fnv1a hash function implementation. More...
 
class  ns3::Hash::Function::Hash32
 Template for creating a Hash::Implementation from a 32-bit hash function. More...
 
class  ns3::Hash::Function::Hash64
 Template for creating a Hash::Implemetation from a 64-bit hash function. More...
 
class  ns3::Hasher
 Generic Hash function interface. More...
 
class  ns3::Hash::Implementation
 Hash function implementation base class. More...
 
class  ns3::Hash::Function::Murmur3
 Murmur3 hash function implementation. More...
 

Enumerations

enum  ns3::Hash::Example::Collider::Bits { ns3::Hash::Example::Collider::Bits32, ns3::Hash::Example::Collider::Bits64 }
 The size of hash function being tested. More...
 
enum  ns3::Hash::Function::Fnv1a::seed { ns3::Hash::Function::Fnv1a::SEED = 0x8BADF00D }
 Seed value. More...
 
enum  ns3::Hash::Function::Murmur3::seed { ns3::Hash::Function::Murmur3::SEED = 0x8BADF00D }
 Seed value. More...
 

Functions

uint32_t ns3::Hash32 (const char *buffer, const size_t size)
 Compute 32-bit hash of a byte buffer, using the default hash function. More...
 
uint32_t ns3::Hash32 (const std::string s)
 Compute 32-bit hash of a string, using the default hash function. More...
 
uint64_t ns3::Hash64 (const char *buffer, const size_t size)
 Compute 64-bit hash of a byte buffer, using the default hash function. More...
 
uint64_t ns3::Hash64 (const std::string s)
 Compute 64-bit hash of a string, using the default hash function. More...
 
typedef uint32_t(* ns3::Hash::Hash32Function_ptr) (const char *, const size_t)
 Function pointer signatures for basic hash functions. More...
 
typedef uint64_t(* ns3::Hash::Hash64Function_ptr) (const char *, const size_t)
 Function pointer signatures for basic hash functions. More...
 

Detailed Description

Generic Hash function interface.

See Hasher for main entry point. See hash-example.cc for example usage.

Typedef Documentation

typedef uint32_t(* ns3::Hash::Hash32Function_ptr) (const char *, const size_t)

Function pointer signatures for basic hash functions.

See Hash::Function::Hash32 or Hash::Function::Hash64

Definition at line 111 of file hash-function.h.

typedef uint64_t(* ns3::Hash::Hash64Function_ptr) (const char *, const size_t)

Function pointer signatures for basic hash functions.

See Hash::Function::Hash32 or Hash::Function::Hash64

Definition at line 112 of file hash-function.h.

Enumeration Type Documentation

The size of hash function being tested.

Enumerator
Bits32 

Use 32-bit hash function.

Bits64 

Use 64-bit hash function.

Definition at line 130 of file hash-example.cc.

Seed value.

Enumerator
SEED 

Ate bad food.

Definition at line 99 of file hash-fnv.h.

Seed value.

This has to be a constant for all MPI ranks to generate the same hash from the same string.

Enumerator
SEED 

Definition at line 102 of file hash-murmur3.h.

Function Documentation

uint32_t ns3::Hash32 ( const char *  buffer,
const size_t  size 
)
inline

Compute 32-bit hash of a byte buffer, using the default hash function.

Parameters
[in]bufferPointer to the beginning of the buffer.
[in]sizeLength of the buffer, in bytes.
Returns
32-bit hash of the buffer.

Definition at line 276 of file hash.h.

References ns3::Hasher::GetHash32().

Referenced by ns3::FqCoDelIpv4PacketFilter::DoClassify(), ns3::FqCoDelIpv6PacketFilter::DoClassify(), and ns3::tests::DefaultHashTestCase::DoRun().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32_t ns3::Hash32 ( const std::string  s)
inline

Compute 32-bit hash of a string, using the default hash function.

Parameters
[in]sString to hash.
Returns
32-bit hash of the string.

Definition at line 290 of file hash.h.

References ns3::Hasher::GetHash32().

+ Here is the call graph for this function:

uint64_t ns3::Hash64 ( const char *  buffer,
const size_t  size 
)
inline

Compute 64-bit hash of a byte buffer, using the default hash function.

Parameters
[in]bufferPointer to the beginning of the buffer.
[in]sizeLength of the buffer, in bytes.
Returns
64-bit hash of the buffer.

Definition at line 283 of file hash.h.

References ns3::Hasher::GetHash64().

Referenced by ns3::tests::DefaultHashTestCase::DoRun().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint64_t ns3::Hash64 ( const std::string  s)
inline

Compute 64-bit hash of a string, using the default hash function.

Parameters
[in]sString to hash.
Returns
64-bit hash of the string.

Definition at line 297 of file hash.h.

References ns3::Hasher::GetHash64().

+ Here is the call graph for this function: