Advertisement
Guest User

Untitled

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