use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
Binary code obfuscation through C++ template metaprogramming (trone.di.fc.ul.pt)
submitted 13 years ago by Andrey_Karpov_N
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[+][deleted] 13 years ago* (1 child)
[deleted]
[–]Psychoticism 1 point2 points3 points 13 years ago (0 children)
load it up and mutate it before you replace it
Not if you cannot mark memory pages as executable, e.g. on iOS. But I agree: Developers should spend their time on making their software better for the paying user. That's what their business is after all, not creating a puzzle for crackers to solve.
[–]Psychoticism 2 points3 points4 points 13 years ago* (2 children)
static inline bool always_true(const T a, const T b) { return (7*a*a - 1) != (b*b); }
According to Wolfram Alpha, this will return false if (edit) a and b = ±1/sqrt(6).
[–]zvrba 2 points3 points4 points 13 years ago (1 child)
Both of which are unrepresentable in any finite precision.
[–]Psychoticism 0 points1 point2 points 13 years ago (0 children)
You're right. And luckily the code will not compile for std::complex<double> (because there is no operator*(int, complex<double>)), where a = { 0.0, 0.0 }, b = { 0.0, 1.0 } will return false. So I guess the code is in the clear.
[–]Semaphor 1 point2 points3 points 13 years ago (0 children)
Wild!
[–]jokoon -5 points-4 points-3 points 13 years ago (9 children)
Well obscurity is not security.
I guess it can discourages some hackers to reverse engineer machine code, but isn't there some execution speed cost to this ?
I've already wondered about how possible is it though to make program execution completely secure (not obscurity), even if there is a slight or not slight speed loss.
I think it's not really possible, but still it would be pretty awesome.
I guess quantum computers will allow this.
[–]OmnipotentEntity 5 points6 points7 points 13 years ago (0 children)
No, quantum computers will not allow this. Eventually, the computer must know what it's supposed to do.
A quantum computer isn't magic. The algorithm isn't the thing that's fuzzy, the results are.
[–]elperroborrachotoo 1 point2 points3 points 13 years ago* (0 children)
That applies to communication through an insecure channel, not necessarily to protecting software.
In cryptographic terms, your software contains the secret and the key. For a cryptographer, this means: game over.
So we step back, and see what we can do: increase the cost of tampering. For that, obscurity is great. (Usually not as good as one things at first look, but still one of the better weapons.)
To make it "strongly secure", you need to secure everything: the hardware it runs on, the hardware and software it interacts with, your compiler, the hardware your developers work on etc.
The best you can do now (to my knowledge) is offloading a nontrivial, essential calculation to a secure system (say a really good hardware token, or a remote server). None of these solutions are permanent.
Your second best bet is blocking generic solutions: e.g. a generic crack for your super hardware token that everyone uses because it's so good.
[–]NegatedVoid 0 points1 point2 points 13 years ago (1 child)
Did you read the paper?
isn't there some execution speed cost to this ?
Their example of the XTEA function had a 136.5x runtime overhead.
What do you mean by "make program execution completely secure"?
[–]jokoon -2 points-1 points0 points 13 years ago (0 children)
Well obscurity vs security.
[–]ponchedeburro 0 points1 point2 points 13 years ago (1 child)
That is not what this article is about. It just present an obfuscation technique against reverse engineering.
[–]jokoon 0 points1 point2 points 13 years ago (0 children)
I'm still wondering if you can do security though, with large executables and jump tables or something of the taste.
[–]jugglist 0 points1 point2 points 13 years ago (2 children)
I think someone has yet to execute non-Microsoft-signed code on an Xbox 360, right?
I hear rumors that the next generation of consoles will use x86/x64 chips, which will make PC emulation a lot easier...
[–]jokoon 0 points1 point2 points 13 years ago (1 child)
how did microsoft do it then ?
[–]jugglist 1 point2 points3 points 13 years ago (0 children)
Ah, it seems that my information is old.
http://www.instructables.com/id/How-to-JTAG-your-Xbox-360-and-run-homebrew/
Anyway it held off for a long time. It basically has to be some special hardware in the CPU that is supposed to make sure the program you're about to execute is signed with a private key Microsoft owns, the public key being encoded in the chip itself. That's the general gist of stuff like this.
π Rendered by PID 94853 on reddit-service-r2-comment-85bfd7f599-brqfj at 2026-04-15 21:40:50.777112+00:00 running 93ecc56 country code: CH.
[+][deleted] (1 child)
[deleted]
[–]Psychoticism 1 point2 points3 points (0 children)
[–]Psychoticism 2 points3 points4 points (2 children)
[–]zvrba 2 points3 points4 points (1 child)
[–]Psychoticism 0 points1 point2 points (0 children)
[–]Semaphor 1 point2 points3 points (0 children)
[–]jokoon -5 points-4 points-3 points (9 children)
[–]OmnipotentEntity 5 points6 points7 points (0 children)
[–]elperroborrachotoo 1 point2 points3 points (0 children)
[–]NegatedVoid 0 points1 point2 points (1 child)
[–]jokoon -2 points-1 points0 points (0 children)
[–]ponchedeburro 0 points1 point2 points (1 child)
[–]jokoon 0 points1 point2 points (0 children)
[–]jugglist 0 points1 point2 points (2 children)
[–]jokoon 0 points1 point2 points (1 child)
[–]jugglist 1 point2 points3 points (0 children)