#pragma once
#include <string>
#include <array>

template <size_t N, char KEY>
class ObfuscatedString {
private:
    std::array<char, N> data;

public:
    constexpr ObfuscatedString(const std::array<char, N>& obfuscatedData)
        : data(obfuscatedData) {
    }

    std::string decrypt() const {
        std::string result;
        result.reserve(N);
        for (char c : data) {
            result.push_back(c ^ KEY);
        }
        return result;
    }
};

// Helper constexpr pour faire le chiffrement à la compilation
template <char KEY, size_t N>
constexpr auto make_obfuscated(const char(&input)[N]) {
    std::array<char, N> result{};
    for (size_t i = 0; i < N; ++i) {
        result[i] = input[i] ^ KEY;
    }
    return ObfuscatedString<N, KEY>(result);
}
