Ideas on scrambling the output

JohnW63

Am am rather close to finishing my project, but I have one more question.

What would be the best method to scramble the text output of the plugin ? I don't want the users to be able to read it, when it is done, so they aren't able to edit it and bypass my race checks. I thought about changing the output as it is created, but I would have to make changes through out the plugin to mix it all up. I thought about only scrambling the important data and leaving some of the default output like " Starting Session " alone. Finally, I wondered about closing the file at the end, reopening it and altering the text as a whole, as I write it back out, the last time.

There aren't any built in C++ functions to alter stuff in a way that I could quickly unscramble it, once the players send me their files. I thought about simply changing the data types in the fprintf calls so it is put out "wrong" and then fix it after I get it.

What's the best way to approach this ?
 
Maybe put some code in EndSession that opens the output file and then reads the entire contents then appends a password that only you know and then does an MD5 hash and then writes it back to the disk. The only problem with this is someone could exit to the monitor and then open the output and change it. Then when they exit the server, EndSession will sign the modified version. So maybe you should just build the output in memory and then write the signed output when EndSession is called. The problem with that is if rFactor crashes it will never save the output.

So for example. Say your output file looks like this:
Code:
2012-02-28 08:21AM - FL Changed

So then you would read this output file into memory and then append your password. Say 12345. So the memory contents would look like this:
Code:
2012-02-28 08:21AM - FL Changed
12345

So an MD5 hash of that would be b80d8949538d1f78966c6b15117b6356.

So then you would rewrite this output to the file:
Code:
2012-02-28 08:21AM - FL Changed
b80d8949538d1f78966c6b15117b6356

You could then write a program for checking the files to be sure they weren't tampered with.
 
So, at least reading back in, at the end, and altering it is not a bad idea. At this point, I want to make it hard to read, but I was not looking forward to writing a decoding program to do it. I knew I had read something about hash tables , in one of my threads here, but my research on them didn't make it seem like an easy addition. I was thinking of outputting the file as text, but simply altering it in such a way only a dedicated programer might see the pattern. Maybe add 10 to every ASCII character, or output as a digit format rather than string, or something.

The author of our original plugin had the file saved as a type I didn't know at all and provided a reader program that took input like the folder the stack of driver files were in and whether I wanted the output as CSV format or something else. Then, he stopped showing up and responding to my requests for bug checks. I still want the drivers to feel they can trust the files the others are sending in were not doctored, but I don't have the know how yet, to duplicate what we have, in a more fool proof program.
 

Back
Top