Sign in to follow this  
Followers 0
McGod

Need a little converting help

2 posts in this topic

I have a function in both Actionscript and C++, but I have no idea on how exactly to convert to autoit.

function getStringHashBase(s, hash) 
 { 
     var __reg3 = undefined; 
     var __reg2 = undefined; 
     __reg2 = 0; 
     while (__reg2 < s.length)  
     { 
         hash = (hash << 4) + s.charCodeAt(__reg2); 
         if (__reg3 = hash & 4.02653e+009)  
         { 
             hash = hash ^ __reg3 >> 24; 
             hash = hash ^ __reg3; 
         } 
         ++__reg2; 
     } 
     return hash; 
 }

C++:

DWORD   GetStringHashBase(CHAR* szString, DWORD dwHash) 
 { 
       DWORD dwLoc3 = NULL; 
  
       for(UINT i = 0; i < strlen(szString); i++) 
       { 
          dwHash = (dwHash << 4) + szString[i]; 
          dwLoc3 = dwHash & 4,026532E+009; 
  
          if(dwHash & 4,026532E+009) 
          { 
             dwHash = dwHash ^ dwLoc3 >> 24; 
             dwHash = dwHash ^ dwLoc3; 
          } 
       } 
  
    return dwHash; 
 }

As far as I have gotten on Autoit

Func GetStringHashBase($String, $Hash)
    Local $sSplit = StringSplit($String, "")
    For $n = 1 To $sSplit[1] Step 1
        $dwHash = BitShift($dwHash, -4)
    Next
EndFunc

:)

Share this post


Link to post
Share on other sites



Hmmm,

maybe like this here ...

Func GetStringHashBase($sString, $dwHash)
    
    ; null terminated C string.
    Local $dwLoc3, $szSplit = StringSplit($sString & Chr(0), "")
    
    For $i = 1 To $szSplit[1]
        
        $dwHash = BitShift($dwHash, -4) + $szSplit[$i]
        $dwLoc3 = BitAND($dwHash, 4, 026532E+009)
        
        If BitAND($dwHash, 4, 026532E+009) Then
            
            $dwHash = BitXOR($dwHash, BitShift($dwLoc3, 24))
            $dwHash = BitXOR($dwHash, $dwLoc3)
            
        EndIf
    Next
    
    Return $dwHash
    
EndFunc
#cs
 DWORD   GetStringHashBase(CHAR* szString, DWORD dwHash)
{
       DWORD dwLoc3 = NULL;
  
       for(UINT i = 0; i < strlen(szString); i++)
       {
          dwHash = (dwHash << 4) + szString[i];
          dwLoc3 = dwHash & 4,026532E+009;
  
          if(dwHash & 4,026532E+009)
          {
             dwHash = dwHash ^ dwLoc3 >> 24;
             dwHash = dwHash ^ dwLoc3;
          }
       }
  
    return dwHash;
}
#ce

Greetz

Greenhorn

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0