sasho648 0 Newbie Poster

I'm dissasemling an debug exe and I found a function that convert a file hash (from an archive that is used from the program) to a string. I really need to know what this function did but I don't understoos this werid language. Here are pictures of the source:

http://imageshack.us/photo/my-images/51/hashfunc1.png/

http://imageshack.us/photo/my-images/51/hashfunc2.png/

.text:00482B60 _STRING_GetHashValue proc near          ; CODE XREF: _animLoadCharWad+2F7p
.text:00482B60                                         ; sub_481290+3Fp ...
.text:00482B60
.text:00482B60 arg_0           = dword ptr  4
.text:00482B60
.text:00482B60                 push    ebp
.text:00482B61                 mov     ebp, [esp+4+arg_0]
.text:00482B65                 push    esi
.text:00482B66                 push    edi
.text:00482B67                 mov     edi, ebp
.text:00482B69                 or      ecx, 0FFFFFFFFh
.text:00482B6C                 xor     eax, eax
.text:00482B6E                 repne scasb
.text:00482B70                 not     ecx
.text:00482B72                 dec     ecx
.text:00482B73                 mov     esi, ecx
.text:00482B75                 mov     eax, ecx
.text:00482B77                 sar     esi, 6
.text:00482B7A                 inc     esi
.text:00482B7B                 test    ecx, ecx
.text:00482B7D                 jle     short loc_482B9D
.text:00482B7F                 push    ebx
.text:00482B80
.text:00482B80 loc_482B80:                             ; CODE XREF: _STRING_GetHashValue+3Aj
.text:00482B80                 mov     edx, eax
.text:00482B82                 mov     edi, eax
.text:00482B84                 shl     edx, 5
.text:00482B87                 sar     edi, 2
.text:00482B8A                 xor     ebx, ebx
.text:00482B8C                 add     edx, edi
.text:00482B8E                 mov     bl, [ebp+0]
.text:00482B91                 sub     ecx, esi
.text:00482B93                 add     edx, ebx
.text:00482B95                 xor     eax, edx
.text:00482B97                 inc     ebp
.text:00482B98                 test    ecx, ecx
.text:00482B9A                 jg      short loc_482B80
.text:00482B9C                 pop     ebx
.text:00482B9D
.text:00482B9D loc_482B9D:                             ; CODE XREF: _STRING_GetHashValue+1Dj
.text:00482B9D                 pop     edi
.text:00482B9E                 pop     esi
.text:00482B9F                 pop     ebp
.text:00482BA0                 retn
.text:00482BA0 _STRING_GetHashValue endp
.text:00482BA0
.text:00482BA0 ; 
---------------------------------------------------------------------------

I will be very happy if someone translate this on c.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.