SafeVar is a C++14 library for secure variable storage, memory obfuscation, and anti-cheat protection. It provides a SafeVar<T> template for securely storing variables in memory, using ChaCha20 encryption, custom memory pools, and fake address simulation to resist memory scanning and tampering.
- Secure Variable Storage: Obfuscates and encrypts variable values in memory.
- ChaCha20 Encryption: Fast, modern stream cipher for data protection.
- Custom Memory Pool: Efficient and secure memory management.
- Fake Address Simulation: Returns fake addresses to mislead memory scanners.
- Serialization/Deserialization: Securely save and restore variable state.
- Thread-Safe Allocators: Safe for use in multithreaded environments.
- Windows Support: Uses Windows API for real memory allocation.
- Windows (uses
VirtualAlloc/VirtualFree) - C++14 compatible compiler (Visual Studio 2015+ recommended)
-
Include the header:
#include "SafeVar.hpp"
-
Declare and use a secure variable:
SafeVar<int> myScore(1234); // Access value int score = myScore.Get(); // Set value myScore = 5678; // Arithmetic myScore += 100;
-
Serialization:
auto serialized = myScore.Serialize(); // ... save to file or send over network
-
Deserialization:
SafeVar<int> loadedScore; loadedScore.Deserialize(serialized.data(), serialized.size());
- Obfuscation: Values are encrypted in memory and re-keyed on each write.
- Fake Addresses:
GetFakeAddress()returns a simulated address to mislead cheaters. - Memory Validation: Internal checks ensure memory integrity.
#include "SafeVar.hpp"
#include <iostream>
int main() {
SafeVar<int> secret(42);
stdcout << "Secret: " << secret << stdendl;
secret += 8; stdcout << "Updated: " << secret.Get() << stdendl; stdcout << "Fake address: 0x" << stdhex << secret.GetFakeAddress() << std::endl;
}Copyright (c) 2025 YXGames.
All rights reserved.
Christian Louis Abrigo (YeXiuPH)
For research, anti-cheat, and educational use only. Not intended for malicious purposes.