I am trying to build a ReTrust system which requires that DLL files be transferred from one system to another. Thus to just add a bit of complexity, I would like to Randomize the code - i.e change the code in a way that every time I have to send a DLL, it will be different then the one sent previously. Please suggest some measures. (Note- DLL here is .NET Dlls)
You could preprocess the source code files before compilation to add a random amount of random code that doesn't actually do anything. It would be simple enough to add innocuous comments in the real source code where you wanted your junk code to be inserted. As far as what you do when you are not trying to do anything, my suggestions would be not to loop or wait for too long, or allocating too much memory. I would err on the side of not caring what the size of the binary output is, and letting that vary wildly. Possibly the easiest and most effective way to accomplish that might be to just include some libraries that don't get called, and yet don't get optimized out because they were not called. If you have your compiler optimized, call something quick just so that the lib will get included for real. Your final binaries would differ in size by quite a bit that way, but the program wouldn't be appreciably any slower.
How different do you want it to be each time? You could always run it through an obfuscator?