Linked Questions

166 votes
21 answers
112k views

Being able to create and manipulate strings during compile-time in C++ has several useful applications. Although it is possible to create compile-time strings in C++, the process is very cumbersome, ...
void-pointer's user avatar
  • 15.1k
109 votes
14 answers
49k views

I need to store sensitive information (a symmetric encryption key that I want to keep private) in my C++ application. The simple approach is to do this: std::string myKey = "...
Thomi's user avatar
  • 11.8k
107 votes
8 answers
53k views

I'm trying to compute the length of a string literal at compile time. To do so I'm using following code: #include <cstdio> int constexpr length(const char* str) { return *str ? 1 + length(...
Mircea Ispas's user avatar
  • 20.9k
32 votes
7 answers
28k views

I'm trying to precompute random values using C++11's random library at compile time. I'm mostly following examples. What am I doing wrong here? using namespace std; #include <iostream> #include ...
pyCthon's user avatar
  • 12.5k
23 votes
8 answers
31k views

I don't want reverse-engineers to read the plain-text of hardcoded strings in my application. The trivial solution for this is using a simple XOR-Encryption. The problem is I need a converter and in ...
Listing's user avatar
  • 1,201
17 votes
4 answers
17k views

I want to encrypt/encode a string at compile time so that the original string does not appear in the compiled executable. I've seen several examples but they can't take a string literal as argument. ...
karliwson's user avatar
  • 3,486
4 votes
4 answers
2k views

I have some SQL queries with binds in my C++ code, those queries are static const std::string, because those queries are complex it is very easy to be wrong with some details. I would like to do some ...
Mauricio Ruiz's user avatar
4 votes
1 answer
2k views

My app contains numerous IDs. I want to eventually make the code viewable by others, but not make it easy for runtime reverse engineers to look for easily known IDs. Also, during development it is ...
rtischer8277's user avatar
3 votes
1 answer
1k views

I trying to write function, for compile-time hide (obfuscate) text strings in the binary code. Purpose: to disable easy search and modify text messages with binary editor. Algorithm is simple: convert ...
olegarch's user avatar
  • 3,911
4 votes
2 answers
585 views

I have an application that uses strings with long chains of repeated characters. I want to add them to the binary in compressed/obfuscated form. I'm currently using a modified RLE algorithm for ...
Fred Helmers's user avatar
1 vote
0 answers
187 views

Hi (sorry for the title - I couldnt make it more meaningfull), I am using encryption of string literals using constexpr from here: Compile time string encryption using constexpr I use it to hide ...
mike's user avatar
  • 1,740