diff --git a/obfuscator.hpp b/obfuscator.hpp new file mode 100644 index 0000000..dd63612 --- /dev/null +++ b/obfuscator.hpp @@ -0,0 +1,42 @@ +#ifndef OBFUSCATOR_HPP +#define OBFUSCATOR_HPP + +#include + +#define STRING_OBFS + + +namespace obfs { + template + class String { + public: + template + constexpr String(char const* str, + std::index_sequence): + str{ encoder(str[Idx])... } { + // Do Nothing + } + + constexpr size_t len() const { + return size; + } + + inline char const* decode() const { + for (char& chr : str) { + chr = decoder(chr); + } + return str; + } + + private: + mutable char str[size]; + }; + + template + constexpr auto make_string(char const (&str)[size]) { + return String(str, std::make_index_sequence()); + } +} + + +#endif