0

I have a program that I am re-writing in C#. There is a function that I do not have the code for that I would like to recreate in the re-write. Based on my investigation I believe that it is an RNG of some sort.

I have isolated the seed value and output of the function. It generates an unsigned integer (seed) on program startup and then produces a 256 uint array based on that seed. The program uses the values in the array and once the program reaches the end of the array the seed increments by 1 and the output of the array changes.

What I have tried: I've set up tests using the algorithms for all the popular(?) RNG/PRNG methods that I could find (mersenne twister, xor32, etc). I figured they might have used one of these when creating the function but have failed to reproduce the output.

My question is, if I have the output and the seed, is there a way to reproduce the function that produced this output? I want to recreate it if possible.

dcreight
  • 641
  • 6
  • 18
  • 1
    The seed is always the same? if the seed doesn't change, why not just create a static array, or just store it in a DB? why generate it everytime if its always the same? – Limey Jun 15 '12 at 17:33
  • The seed does change, after it goes through the array values to the end the seed increases by 1 and the array is built again with new values. Sorry for the confusion. Edited my question to make it more clear. – dcreight Jun 15 '12 at 20:08
  • Can't you port the exact code? – usr Jun 15 '12 at 20:15
  • @usr - Unfortunately I don't have the code for this part application. So I have to try and recreate what they did originally. – dcreight Jun 15 '12 at 20:34
  • Ok you have a nasty reverse engineering task on your hands. Can you look at the disassembly (or is it managed code)? Without looking at code or disassembly you basically have lost. – usr Jun 15 '12 at 21:19
  • That is what I was afraid of, yes I can look at the disassembly. I managed to glean the information I have so far from a mix of using a disassembler and looking at the memory map. I'm not very familiar with disassemblers or reverse engineering so I may just rewrite the entire thing from the ground up. – dcreight Jun 15 '12 at 22:02

0 Answers0