libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
obfuscatedstring.h File Reference
#include <cstddef>
#include <cstdint>
#include <promeki/core/namespace.h>
#include <promeki/core/string.h>
#include <promeki/core/fnv1a.h>
Include dependency graph for obfuscatedstring.h:

Go to the source code of this file.

Classes

class  ObfuscatedString< N, Seed >
 Compile-time string obfuscation. More...
 

Macros

#define PROMEKI_OBFUSCATE_SEED
 Combines FILE, LINE, DATE, and TIME into a unique per-site seed.
 
#define PROMEKI_OBFUSCATE(str)
 Obfuscates a string literal at compile time.
 

Detailed Description

See LICENSE file in the project root folder for license information.

Macro Definition Documentation

◆ PROMEKI_OBFUSCATE

#define PROMEKI_OBFUSCATE (   str)
Value:
([]() { \
static constexpr auto _obf = \
::promeki::ObfuscatedString<sizeof(str), PROMEKI_OBFUSCATE_SEED>(str); \
return _obf.decode(); \
}())
Dynamic array container wrapping std::vector.
Definition list.h:40

Obfuscates a string literal at compile time.

The string is encoded at compile time and decoded at runtime on each access. Returns a promeki::String containing the original plaintext.

Parameters
strThe string literal to obfuscate.

◆ PROMEKI_OBFUSCATE_SEED

#define PROMEKI_OBFUSCATE_SEED
Value:
(::promeki::fnv1a(__FILE__) ^ (static_cast<uint64_t>(__LINE__) * 0x9e3779b97f4a7c15ULL) ^ \
::promeki::fnv1a(__DATE__ __TIME__))

Combines FILE, LINE, DATE, and TIME into a unique per-site seed.