jaffarCommon
Loading...
Searching...
No Matches
Typedefs | Functions
hash.hpp File Reference

Contains common function related to hashing. More...

#include <metrohash128/metrohash128.h>
#include <sha1/sha1.hpp>
#include <stdio.h>
#include <string>
Include dependency graph for hash.hpp:

Go to the source code of this file.

Typedefs

typedef _uint128_t jaffarCommon::hash::hash_t
 

Functions

__JAFFAR_COMMON__INLINE__ std::string jaffarCommon::hash::getSHA1String (const std::string &string)
 
__JAFFAR_COMMON__INLINE__ hash_t jaffarCommon::hash::calculateMetroHash (const void *data, size_t size)
 
__JAFFAR_COMMON__INLINE__ std::string jaffarCommon::hash::hashToString (const hash_t hash)
 
__JAFFAR_COMMON__INLINE__ hash_t jaffarCommon::hash::hashString (const std::string &string)
 

Detailed Description

Contains common function related to hashing.

Typedef Documentation

◆ hash_t

typedef _uint128_t jaffarCommon::hash::hash_t

Definition for the standard 128-bit hash value in Jaffar.

Function Documentation

◆ calculateMetroHash()

__JAFFAR_COMMON__INLINE__ hash_t jaffarCommon::hash::calculateMetroHash ( const void *  data,
size_t  size 
)

Calculates the 128 bit Metrohash of a given buffer

Parameters
[in]dataThe input buffer to hash
[in]sizeThe size of the buffer to hash
Returns
The calculated 128-bit metro hash

◆ getSHA1String()

__JAFFAR_COMMON__INLINE__ std::string jaffarCommon::hash::getSHA1String ( const std::string &  string)

Calculates the SHA1 sum of a given input string and returns it as a stylized (string)

Parameters
[in]stringThe input string
Returns
The SHA1 string of the input string

◆ hashString()

__JAFFAR_COMMON__INLINE__ hash_t jaffarCommon::hash::hashString ( const std::string &  string)

Calculates the 128-bit metro hash of a given string

Parameters
[in]stringThe string to calculate the hash for
Returns
The hash value of the provided string

◆ hashToString()

__JAFFAR_COMMON__INLINE__ std::string jaffarCommon::hash::hashToString ( const hash_t  hash)

Produces an output string given a 128-bit hash

Parameters
[in]hashThe hash value to stringify
Returns
The string containing the stringified hash, formatted as upper case hexadecimal