Sen API
Sen Libraries
Loading...
Searching...
No Matches
hash32.h File Reference

This file contains functions related to hashing and compression. This is mainly used by Sen internals, but it's exposed to the public API as a convenience utility. More...

#include "sen/core/base/numbers.h"
#include <array>
#include <cstdint>
#include <cstring>
#include <filesystem>
#include <numeric>
#include <string>
#include <string_view>

Go to the source code of this file.

Namespaces

namespace  sen

Functions

template<typename InputIterator>
u32 sen::crc32 (InputIterator first, InputIterator last) noexcept
 Calculates the CRC32 for any sequence of values. (You could use type traits and a static assert to ensure the values can be converted to 8 bits.).
u32 sen::crc32 (std::string_view str) noexcept
 CRC32 for strings.
template<typename... Types>
u32 sen::hashCombine (u32 seed, const Types &... args) noexcept
 Combines the hash of different values into a single 32-bit hash.
template<typename... Types>
uint_fast32_t sen::platformDependentHashCombine (uint_fast32_t seed, const Types &... args) noexcept
 Old version of the hashCombine method. The current one replaced this implementation to allow sen processes to discover and connect themselves between platforms (Windows and Linux). We keep this old implementation to enable replaying Sen recordings generated with the old hashes.
unsigned char * sen::decompressSymbol (const void *compressedData)
 Decompresses a blob into its original shape.
std::string sen::decompressSymbolToString (const void *compressedData, unsigned int originalSize)
 Decompresses a blob into a string.
bool sen::fileToCompressedArrayFile (const std::filesystem::path &inputFile, std::string_view symbolName, const std::filesystem::path &outputFile)
 Creates a C++ source file that contains an array representing the contents of another file.
template<typename... Types>
std::uint_fast32_t sen::platformDependentHashCombine (std::uint_fast32_t seed, const Types &... args) noexcept

Variables

constexpr u32 sen::hashSeed = 23835769U
 Initial seed for all hashes.
constexpr u32 sen::propertyHashSeed = 19830715U
constexpr u32 sen::methodHashSeed = 93580253U
constexpr u32 sen::eventHashSeed = 12125807U
constexpr u32 sen::nonPresentTypeHash = 18121997U
 This hash is combined when no Type is found in a certain spec.

Detailed Description

This file contains functions related to hashing and compression. This is mainly used by Sen internals, but it's exposed to the public API as a convenience utility.