private static short Transform(short iInput)
iRem = (ushort)(iInput % 178);
iTemp = (ushort)(iInput / 178);
iTemp = (ushort)(iTemp * -1);
result = (ushort)(iTemp << 6);
result = (ushort)(result - iTemp);
iRem = (ushort)(iRem * 170);
if (((iRem + result) & 0x8000) == 0x8000)
result = (ushort)(iRem + result);
result = (ushort)(result + 0x7673);
private static short Transform2(short iInput)
iRem = (ushort)(iInput % 177);
iTemp = (ushort)(iInput / 177);
iT = (ushort)(iTemp * -1);
result = (ushort)(iT - iTemp);
iRem = (ushort)(iRem * 171);
if (((iRem + result) & 0x8000) == 0x8000)
result = (ushort)(iRem + result);
result = (ushort)(result + 0x763d);
public uint seed_calc(uint seedq, uint wKey,int flag)
wKey = (uint)Transform((short)wKey);
Console.WriteLine("Our Base {0:X8}",wKey);
wT = (int)(((seedq >> 24) << 8) | (seedq & 0xFF));
wTemp2 = (int)Transform2((short)wT);
wT = (int)((((seedq >> 16) & 0xFF) << 8) | ((seedq >> 8) & 0xFF));
wTemp = Transform((short)wT);
wTemp = (ushort)(Transform2((short)wTemp2)) | wTemp;
dwSeed = (wTemp2 << 16) | (wTemp & 0xFFFF);
public static void Main()
Console.WriteLine("{0:X8}",myseed.seed_calc(0xDE9C82D0,0xFFFF,1));
Console.WriteLine("{0:X8}",myseed.seed_calc(0xDE9C82D0,0x75C9,0));