Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am working on a MIPS project that involves encrypting / decrypting a string by

ID: 3600827 • Letter: I

Question

I am working on a MIPS project that involves encrypting / decrypting a string by iterating through said string, adding a value to the charcter's ascii value and toggle a bit with xor. With the code I have:

.data

prompt_string: .asciiz "Enter text to encrypt:"

user_string: .byte 0x0f:100

message:.asciiz "Encrypted Text:"

.text

#prompt user for string

la $a0,prompt_string

li $v0,4

syscall

#enter user input into memory called user_string

la $t0,user_string

la $a1,10

li $v0,8

syscall

la $t0,user_string

lb $t1,0($t0)

addi $t1,$t1,4 #addition key

li $s0,0x01

li $v0,1 #toggle key

sllv $s0,$s0,$v0

xor $t4,$t1,$s0

la $t5 user_string

sb $t4,0($t5)

#display output

li $v0,4

la $a0,message

syscall

#display encrypted text

li $v0,4

la $a0,user_string

syscall

##questions

how to put variablr into addition key and toggle key?(must created prompt for those)

how to loop to next charcter for instance the 'e' in "Hello" (addi $t0,$t0,1)

Explanation / Answer

.text

#prompt user for string

la $a0,prompt_string

li $v0,4

syscall

#enter user input into memory called user_string

la $t0,user_string

la $a1,10

li $v0,8

syscall

la $t0,user_string

lb $t1,0($t0)

addi $t1,$t1,4 #addition key

li $s0,0x01

li $v0,1 #toggle key

sllv $s0,$s0,$v0

xor $t4,$t1,$s0

la $t5 user_string

sb $t4,0($t5)

#display output

li $v0,4

la $a0,message

syscall

#display encrypted text

li $v0,4

la $a0,user_string

syscall

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote