Advertisement
Guest User

Untitled

a guest
Jul 28th, 2012
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.98 KB | None | 0 0
  1. unsigned int g_res;
  2. /*...*/
  3. unsigned int hashASDF2( char* input_string )
  4. {
  5.     _asm{
  6. //      result_hash= dword ptr -8
  7. //      loop_counter= dword ptr -4
  8. //      input_string= dword ptr  4
  9.  
  10. #define result_hash dword ptr -8
  11. #define loop_counter dword ptr -4
  12. //#define   input_string dword ptr  4
  13.  
  14.         sub     esp, 8
  15.         push    ebx
  16.         push    ebp
  17.         xor     ecx, ecx
  18.         push    esi
  19.         mov     [esp+14h+result_hash], ecx
  20.         mov     [esp+14h+loop_counter], ecx
  21.         push    edi
  22.  
  23.         loc_4010A1:                             ; CODE XREF: hash_func+7Fj
  24.         mov     eax, [input_string]     ; <--- tu jest bug ;/
  25.         movsx   edi, byte ptr [ecx+eax]
  26.         xor     edx, edx
  27.         xor     ecx, ecx
  28.         lea     ecx, [ecx+0]
  29.  
  30.         loc_4010B0:                             ; CODE XREF: hash_func+3Dj
  31.         mov     eax, 1
  32.         shl     eax, cl                         ; 1<<i (2^i)
  33.         mov     ebx, eax
  34.         and     ebx, [esp+18h+result_hash]
  35.         mov     esi, eax
  36.         and     esi, edi
  37.         cmp     ebx, esi
  38.         jz      short loc_4010C7
  39.         or      edx, eax
  40.  
  41.         loc_4010C7:                             ; CODE XREF: hash_func+33j
  42.         add     ecx, 1
  43.         cmp     ecx, 20h
  44.         jl      short loc_4010B0
  45.         lea     esi, [edx+edi]
  46.         add     esi, esi
  47.         add     esi, esi
  48.         add     esi, esi
  49.         xor     eax, eax
  50.         xor     ecx, ecx
  51.         lea     esp, [esp+0]
  52.  
  53.         loc_4010E0:                             ; CODE XREF: hash_func+6Bj
  54.         mov     edx, 1
  55.         shl     edx, cl                         ; 1<<i (2^i)
  56.         mov     ebx, edx
  57.         mov     ebp, edx
  58.         and     ebx, esi
  59.         and     ebp, edi
  60.         cmp     ebx, ebp
  61.         jz      short loc_4010F5
  62.         or      eax, edx
  63.  
  64.         loc_4010F5:                             ; CODE XREF: hash_func+61j
  65.         add     ecx, 1
  66.         cmp     ecx, 20h
  67.         jl      short loc_4010E0
  68.         mov     ecx, [esp+18h+loop_counter]
  69.         add     ecx, 1
  70.         cmp     ecx, 7
  71.         mov     [esp+18h+result_hash], eax
  72.         mov     [esp+18h+loop_counter], ecx
  73.         jl      short loc_4010A1
  74.         mov     g_res, eax
  75.         pop     edi
  76.         pop     esi
  77.         pop     ebp
  78.         pop     ebx
  79.         add     esp, 8
  80.     }
  81.     return g_res;
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement