Skip to content

About

Encrypted String in C++

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

EncryptedSTDString

enc_str.h is a small header-only string wrapper that keeps its contents encrypted in memory and decrypts them only when needed.

What it does

  • Stores string data in an encrypted byte buffer
  • Supports construction from const char*, std::string, and stdenc::string
  • Supports secure comparison with ==, compare(), and equals()
  • Use c_str() for temporary access to a plain C string. Should be freed with c_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.

Basic usage

#include "enc_str.h"
#include <iostream>

int main() {
    stdenc::string str = "Hello, World!";

    if (str == "Hello, World!") {
        std::cout << "yay" << std::endl;
    }

}

Notes

  • I built this very hastely together because i just wanted to test GTest. Its still in my opinion very well optimized and written

About

Encrypted String in C++

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages