enc_str.h is a small header-only string wrapper that keeps its contents encrypted in memory and decrypts them only when needed.
- Stores string data in an encrypted byte buffer
- Supports construction from
const char*,std::string, andstdenc::string - Supports secure comparison with
==,compare(), andequals() - Use
c_str()for temporary access to a plain C string. Should be freed withc_str_free()after use to avoid unencrypted strings stored in memory, but does not need to be called. It will get called internally when the string deconstructs.
#include "enc_str.h"
#include <iostream>
int main() {
stdenc::string str = "Hello, World!";
if (str == "Hello, World!") {
std::cout << "yay" << std::endl;
}
}- I built this very hastely together because i just wanted to test GTest. Its still in my opinion very well optimized and written