Hack Forums
[Assembly] How to convert a C++ algorithm to mips - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Coders Lounge (https://hackforums.net/forumdisplay.php?fid=5)
+---- Thread: [Assembly] How to convert a C++ algorithm to mips (/showthread.php?tid=5740196)



How to convert a C++ algorithm to mips - myt21 - Oct 19, 2017

So I have created the c++ algorithm but I have no idea how to convert it into mips
Code
void
decrypt(unsigned char *ciphertext, unsigned char *plaintext, unsigned char *key,
unsigned char rounds) {
unsigned char A[16];
unsigned char B[16];
unsigned char C[16];
unsigned char D[16];
key_addition(ciphertext, &key[16 * rounds], C);
inv_shift_rows(C, (unsigned int *) B);
inv_byte_substitution(B, A);
for (unsigned int k = rounds - 1; k > 0; k--) {
key_addition(A, &key[16 * k], D);
inv_mix_column(D, C);
inv_shift_rows(C, (unsigned int *) B);
inv_byte_substitution(B, A);
}
key_addition(A, key, plaintext);
return;
}

any one know how to do this


* - Glass Bones - Oct 20, 2017

Try looking into the Codescape MIPS SDK


RE: How to convert a C++ algorithm to mips - drrrrrr - Nov 5, 2017

Most of this function are command in MIPS, you must download the manual and search for what you need.


RE: How to convert a C++ algorithm to mips - 0xZyd - Feb 3, 2018

you should cross-compile your code
just download mips compiler for your system


RE: How to convert a C++ algorithm to mips - Desomond - Feb 4, 2018

You can use this website.

reliant.colab.duke.edu/c2mips/

And to become familiar with MIPS assembly you can use SPIM
It will run your mips program so you can build and test it.

/spimsimulator.sourceforge.net/

And if you google MIPS instruction reference you can learn what each instruction does. Manually playing compiler for the whole program is not easy but it helps to understand what your assembly is actually doing.