..--------------------------------------------------------..
..             ..
..                  (x86)                     ..
..________________________________________________________..


                                ,   
                            ,  ,    .
                            ,    ,  
                                ,   .

                                               () -,  


                  
      "": ,  , 
            .           
              .  ,  
   ,   ,  ,     (
                  :).   
        . ,       
    :        ,  
            .     
    ,     -   .

     -  . , , ,   
      .

            .       
    ?  ,      ,  
   ,             ( -
    )?        =)

   ,               , ..  
       .        ,
   ,  ,  .

     - ,    .   
         .       ,
    ,    ...   :)


.code
 ;----------------------------------------------
 Test1 proc
	 	pusha
	 	mov	eax, 1
	 	mov	ebx, 2
	 	xor	eax, ebx
	 	popa

	 	ret
 Test1_endp:
 endp
 ;----------------------------------------------
 Test2 proc
	 	pusha
	 	mov	eax, 2
	 	mov	ebx, 3
	 	xor	eax, ebx
	 	popa

	 	ret
 Test2_endp:
 endp
 ;----------------------------------------------
 Test3 proc
	 	pusha
	 	mov	eax, 3
	 	mov	ebx, 4
	 	xor	eax, ebx
	 	popa

	 	ret
 Test3_endp:
 endp


     .       -  
          .          
       .        offset,  
   ,  ,     ,     . 
           . 
     ,           .    
    =)

                -
      -  .       (
      /   ):    
        :

				
	   0		  2			   
	   2		  4			  
	   6		  4			  
	   ...       ...
	   n		  4			c n- 
	   n+4		  4			 n- 

             :)  
       .   -     
    .


.data
 Proc_Entries_Num	dw 3	; - 

 Proc_Entries:
     Test1_addr	dd offset Test1		            ;   
     Test1_len	dd Test1_endp - offset Test1	;  

     Test2_addr	dd offset Test2					;   
     Test2_len	dd Test2_endp - offset Test2	;  

     Test3_addr	dd offset Test3					;   
     Test3_len	dd Test3_endp - offset Test3	;  

     curr_proc	    dd ?	;      
     curr_proc_size	dd ?	;  -  
							;     
							;  ...


    - . ..             
           ,      - 
   .        :    
           ,        
                .  
     .

        -         :)
         .   
    ,    (.. )       CryptProc
       .      Blowfish, MD5    -
   DES  =)    -           
   .        xor.


DecryptProc:
    mov	  esi, eax
    mov	  edi, offset Proc_Entries
    movsx ecx, word ptr Proc_Entries_Num

search:
    mov   edx, dword ptr [edi]
    cmp   edx, esi
    jz    found
    add   edi, 8
    loop  search

    ret

found:
    mov   ecx, dword ptr [edi+4]			;ecx  - size of func
    mov   dword ptr [curr_proc], eax
    mov   dword ptr [curr_proc_size], ecx


decrypt:									; crypto algorithm..
    xor   byte ptr [esi], 66h
    inc   esi
    loop  decrypt

    ret

EncryptProc:
    mov   esi, dword ptr [curr_proc]		; offset of our function
    mov   ecx, dword ptr [curr_proc_size]	; its size

crypt:										; crypto algorithm
    xor   byte ptr [esi], 066h
    inc   esi
    loop  crypt

    ret


     :
   )    
   )         -   ,
                 .  
            ,      ,  , 
      CRC-.       ,   
        .
   )        . , ,
                      ,   
              -    -      
       :)

     ,    ,           
   ,                
   .      .  -  =)

    include/crypt_func  :

   crypt.asm -        .
   test.asm -  .
