Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Assembly 

How to convert a C++ algorithm to mips

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
Try looking into the Codescape MIPS SDK
Most of this function are command in MIPS, you must download the manual and search for what you need.
you should cross-compile your code
just download mips compiler for your system
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.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Help] by RagnexApr 9, 2020 12:46 PM 3 115 Apr 9, 2020 12:46 PM
Last Post: EnG1ne
[Assembly] by NɪᴛᴇJun 26, 2019 09:10 AM 1 240 Jun 26, 2019 09:10 AM
Last Post: magical toaster
[Assembly] by LatiosFeb 9, 2018 09:03 AM 2 241 Feb 9, 2018 09:03 AM
Last Post: Latios