Search code examples
c#compilationhexrecompile

Is it possible to compile decompiled hex code?


Is it possible to compile a SoapHexBinary back to an .exe

var str = new SoapHexBinary(File.ReadAllBytes(@"c:\test\test.exe")).ToString();
Console.WriteLine(str);

Solution

  • byte[] bytes = SoapHexBinary.Parse(str).Value
    

    Note that there's no "compile" here - it is just bytes that happen to be an exe; once you get the bytes back, they are still the same exe (if you'd sent a gif file, it would still be the same gif file, etc). If you want it as a file: write the bytes to the file system.