Index

Subject : Re: LUG: C++/C question

From : Warren Myers <volcimaster@gmail.[redacted]>

Date : Tue, 06 Dec 2011 20:08:14 -0500

Parent


I'd hasten to point out that if you're putting the data in the source file (in any form), it's still readable in a hex editor. In the good old days of DOS/Windows (my exposure to ASM programming), it all goes in the CODE segment - which means it's readable and decipherable by anyone who cares to open the file in a hex reader :)

WMM

On Tue, Dec 6, 2011 at 18:39, Daniel Underwood < daniel.underwood@ncsu.[redacted] > wrote:
Hey folks,

Related to some research I've done, I want to make publicly available a program written in C++.  The problem is that the program reads input data from a bunch of text files, and I can't make the data publicly available due to contractual obligations.  I need to figure out how to rewrite the program so that all of the input data is compiled into the machine code.

There is a lot of data.  Below is a snippet of code to show how much data I'm referring to (each of the constant integers below is the size of a corresponding array of doubles).  Does anyone have any suggestion as to how I might hide this data inside a compiled binary?

(I suspect it's possible to use sed/awk to change the input text files so that they can be placed directly inside the source code files, but I'm wondering if there's a better way to do this.)

Many thanks!
Daniel

[BEGIN CODE]
double AW3[2500];
double AB3[2500];

const int NCa1p1NUM=9925;
const int NCa1p2NUM=832;
const int NCa1p3NUM=160;
const int NCa1p4NUM=72;
const int NCa1p5NUM=88;
const int NCa1p6NUM=28;
const int NCa1p7NUM=50;

const int NCa2p1NUM=30414;
const int NCa2p2NUM=2673;
const int NCa2p3NUM=738;
const int NCa2p4NUM=292;
const int NCa2p5NUM=246;
const int NCa2p6NUM=56;
const int NCa2p7NUM=54;

const int NCa3p1NUM=28647;
const int NCa3p2NUM=3299;
const int NCa3p3NUM=1450;
const int NCa3p4NUM=641;
const int NCa3p5NUM=570;
const int NCa3p6NUM=153;
const int NCa3p7NUM=115;

const int NCa4p1NUM=27370;
const int NCa4p2NUM=3142;
const int NCa4p3NUM=1763;
const int NCa4p4NUM=1150;
const int NCa4p5NUM=1509;
const int NCa4p6NUM=478;
const int NCa4p7NUM=366;

const int CAa1p1NUM=164;
const int CAa1p2NUM=34;
const int CAa1p3NUM=9;
const int CAa1p4NUM=2;
const int CAa1p5NUM=8;
const int CAa1p6NUM=2;
const int CAa1p7NUM=0;

const int CAa2p1NUM=1077;
const int CAa2p2NUM=176;
const int CAa2p3NUM=107;
const int CAa2p4NUM=66;
const int CAa2p5NUM=57;
const int CAa2p6NUM=3;
const int CAa2p7NUM=10;

const int CAa3p1NUM=1815;
const int CAa3p2NUM=223;
const int CAa3p3NUM=180;
const int CAa3p4NUM=177;
const int CAa3p5NUM=218;
const int CAa3p6NUM=42;
const int CAa3p7NUM=20;

const int CAa4p1NUM=2140;
const int CAa4p2NUM=165;
const int CAa4p3NUM=144;
const int CAa4p4NUM=134;
const int CAa4p5NUM=349;
const int CAa4p6NUM=136;
const int CAa4p7NUM=126;
[END CODE]



--
Daniel Underwood
North Carolina State University
PhD Student - Industrial Engineering
email: daniel.underwood@ncsu.[redacted]
phone: XXX.302.3291
fax: XXX.515.5281
web: http://www4.ncsu.edu/~djunderw/




--
Warren Myers
http://warrenmyers.com
http://twitter.com/volcimaster
http://www.linkedin.com/in/warrenmyers

Replies :