Advertisement
Guest User

Untitled

a guest
Apr 28th, 2015
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.97 KB | None | 0 0
  1. char temp_char;
  2.     int i;
  3.  
  4.     __asm
  5.     {
  6.         // for loop starts
  7.         mov     i, 0
  8.         jmp     checkend
  9.  
  10.     forloop1:
  11.         mov     eax,i
  12.         add     eax, 1
  13.         mov     i, eax
  14.  
  15.     checkend:
  16.         cmp     i, [ebp+8]
  17.         jge     endfor1
  18.  
  19.         mov     ecx, i
  20.  
  21.         //og code
  22.         push    eax                 // Save values contained within register to stack
  23.         push    ecx
  24.  
  25.         movzx   ecx, temp_char
  26.         push    ecx                 // Push argument #2
  27.         lea     eax, EKey
  28.         push    eax                 // Push argument #1
  29.         call    encrypt4
  30.         add     esp, 8              // Clean parameters of stack
  31.         mov     temp_char, al       // Move the temp character into a register    
  32.  
  33.         pop     ecx
  34.         pop     eax
  35.         // end of og code
  36.         mov     temp_char, ecx
  37.  
  38.     endfor1:
  39.         mov     eax, temp_char
  40.         mov     EChars, temp_char
  41.     }
  42.     return;
  43.  
  44.     __asm
  45.     {
  46.     encrypt4:
  47.             push    ebp                 // Set stack
  48.             mov     ebp, esp            // Set up the base pointer
  49.  
  50.             mov     eax, [ebp + 8]      // Move value of parameter 1 into EAX
  51.             mov     ecx, [ebp + 12]     // Move value of parameter 2 into ECX
  52.             push    edi                 // Used for string and memory array copying
  53.             push    ecx                 // Loop counter for pushing character onto stack
  54.  
  55.             not     byte ptr[eax]       // Negation
  56.             add     byte ptr[eax], 0x04 // Adds hex 4 to EKey
  57.             movzx   edi, byte ptr[eax]  // Moves value of EKey into EDI using zeroes
  58.             pop     eax                 // Pop the character value from stack
  59.             xor     eax, edi            // XOR character to give encrypted value of source
  60.             pop     edi                 // Pop original address of EDI from the stack
  61.  
  62.             rol     al, 1               // Rotates the encrypted value of source by 1 bit (left)
  63.             rol     al, 1               // Rotates the encrypted value of source by 1 bit (left) again
  64.             add     al, 0x04            // Adds hex 4 to encrypted value of source
  65.  
  66.             mov     esp, ebp            // Deallocate values
  67.             pop     ebp                 // Restore the base pointer
  68.             ret
  69.     }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement