#ifndef RAGNAROK_SOURCE_UTILITY_CIPHER_CRYPTNAME_H #define RAGNAROK_SOURCE_UTILITY_CIPHER_CRYPTNAME_H #include #include #include namespace utility { template struct CryptedText { char data[Length]; // INLINED template constexpr operator std::array() const { std::array out{}; for (std::size_t index = 0; index < Length; ++index) { out[index] = static_cast(this->data[index]); } return out; } }; // INLINED template constexpr CryptedText CryptText(const char (&text)[Length]) { CryptedText out{}; for (std::size_t index = 0; index < Length; ++index) { out.data[index] = static_cast(static_cast(text[index]) ^ static_cast(Key >> (8 * (index & 7)))); } return out; } } #define CRYPT_NAME(text, key) (::utility::CryptText(text)) #endif