Quick Way to Convert One Assembly Language to Another

A few years back, during a technical interview, I was asked about the quick and best way to convert cryptographic code from one assembly language to another. It would be interesting to share my answer here, though the consensus is not to handroll your cryptographic routines but to use the industry standard library but that legacy assembly routine was written way before the consensus was widely known and accepted. Please note my approach will not work for assembly code written in SIMD.

The quick and dirty way is to decompile the binary back to C code using Decompiler Explorer and convert it back to assembly code with Compiler Explorer. If you have concerns about your binary retained by the Decompiler Explorer, you may want to use an offline decompiler. The intermediate C code outputted by the decompiler is raw because there are no meaningful variables or structure names. You can rename the variables or convert the C code to C++, but this step is unnecessary. The technical interviewer was satisfied with my answer.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: