
Trunk appears to be unstable; I can't get a successful build happening. Here's the error I keep getting: boost/utility/value_init.hpp(70) : error C2061: syntax error : identifier 'wrapper_address' Anyway, I see the technique you're using below. I'm going to play around with your idea, and possibly add some more obfuscation and see what I come up with. Thanks so much for the time you spent writing that sample. -Sid -----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Eric Niebler Sent: Monday, April 27, 2009 1:45 PM To: boost@lists.boost.org Subject: Re: [boost] [encrypted strings]
Below is the definition of a std_str() function that takes an mpl::string and turns it into a std::string. (boost/mpl/string.hpp is available on trunk, but hasn't been released yet.) It's not *very* obfuscated, but should be enough to fool a naive string-dump.
#include <string> #include <iostream> #include <boost/mpl/string.hpp> #include <boost/mpl/for_each.hpp> using namespace boost;
struct push_back_str { push_back_str(std::string & s) : str(s) {}
void operator()(char c) const { this->str.push_back(c); } private: std::string & str; };
template<typename String> std::string std_str() { std::string result; result.reserve(mpl::size<String>()); mpl::for_each<String>(push_back_str(result)); return result; }
int main() { std::cout << std_str< mpl::string<'hell','o wo','rld!'> >() << std::endl; return 0; } -- Eric Niebler BoostPro Computing http://www.boostpro.com