Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //----------------------------------------------------------------------------------------------------------
- mov ebx, 0 // Here we create our values for the for loop, we set the index as 0
- jmp checkloop2 // and store it in the ebx register. We then call the check
- // loop method to make sure the length is big enough.
- //------------------------------------------------ LOOP ------------------------------------------------------
- checkloop2 : // Start our method inside the for loop.
- mov edx, len // Set EDX register to the length of our character array.
- cmp ebx, edx // Compare to see if the current index EBX isnt greater than
- jg endloop2 // our length.
- //
- movzx ecx, [ebx + EChars] // Get our current character at the index of EBX.
- lea eax, EKey // We load the value into the memeory address
- // This is so it does not reset every loop.
- //----------------------------------------------- DECRYPT METHOD -------------------------------------------
- ror cl, 2 // Reverse the last ROL operation on the character.
- mov edx, [eax] // Bring edx to store the starting encryption key, recast edx becuase its not needed
- // anymore.
- rol byte ptr[eax], 3 // Access the address of EAX so it does not reset per loop
- // Changing the EKey so the next operation is a correct reversal.
- xor cl, byte ptr[eax] // Xor our new EKey with the current character value.
- // This simply replicates what happened in the encryption part.
- xor cl, dl // Compare our original ekey of this loop to reverse the encryption xor.
- rol cl, 1 // Reverse the ror 1 in the encryption operation by rotating left by 1.
- neg cl // This is the final alteration to our character, we reverse the encrytion
- // 2's Complement by applying it again.
- //----------------------------------- TO LOWER CASE METHOD -------------------------------------------------------------
- cmp cl, 'A' // Check to see of the current ASCII value is larger smaller than 65 (A)
- jl exitnow // If its less then jump away becuase it doest need modifying.
- cmp cl, 'Z' // We need to also make it jump away if its current value is larger than Z (99)
- jg exitnow //
- add cl, 32 // We then add 32 to the current char value, whihc, if it fits the previous statements
- exitnow: // it will capitalise it, as each Upper case character in the ASCII table are 32 values above
- mov [ebx + DChars], cl // Get our value from the ecx register as we're no longer have to return with EAX
- //--------------------------------------------------------------------------------------------------------------
- add ebx, 1 // Increase our current index value of EBX by 1.
- jmp checkloop2 // Send back to the top of the loop and check our conditions again.
- //--------------------------------------------------------------------------------------------------------------
- endloop2:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement