Kawe Mazidjatari 04bee896be Fix string/wstring type conflict
cppkore uses string/wstring as StringBase while we use std::string/std::wstring as string/wstring. Changed all types in cppkore to String/WString instead.
2022-05-21 21:51:35 +02:00

35 lines
1021 B
C++

#pragma once
#include <cstdint>
#include "StringBase.h"
namespace Hashing
{
// This enumeration represents the various supported xxhash versions
enum class XXHashVersion
{
// A 32bit hash value is returned.
XX32,
// A 64bit hash value is returned.
XX64
};
// A hashing algo that implements XXHash.
class XXHash
{
public:
// Computes the hash code of the integral value using XXHash algo.
template<class Tinput>
static uint64_t HashValue(Tinput Input, XXHashVersion Version = XXHashVersion::XX64, uint64_t Seed = 0)
{
return ComputeHash((uint8_t*)&Input, 0, sizeof(Tinput), Version, Seed);
}
// Computes the hash code of the input string using XXHash algo.
static uint64_t HashString(const String& Input, XXHashVersion Version = XXHashVersion::XX64, uint64_t Seed = 0);
// Computes the hash code using the XXHash algo.
static uint64_t ComputeHash(uint8_t* Input, uint64_t InputOffset, uint64_t InputLength, XXHashVersion Version = XXHashVersion::XX64, uint64_t Seed = 0);
};
}