Advertisement
keybode

hash lol

Sep 27th, 2014
425
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. void HashSignature ( const char* sig, const char* smask, DWORD_PTR& hash, DWORD_PTR& mask )
  2. {
  3.     unsigned int uLength = strlen ( smask );
  4.  
  5.     for ( auto i = 0; i < uLength; i++ )
  6.     {
  7.         if ( smask[i] == 'x' )
  8.         {
  9.             mask |= (1 << i);
  10.         }
  11.         else if ( smask[i] == '?' )
  12.         {
  13.             mask |= 0;
  14.         }
  15.     }
  16.  
  17.     char hashed[32];
  18.  
  19.     for ( int i = 0; i < 32; i++ )
  20.     {
  21.         if ( i < uLength )
  22.         {
  23.             if ( sig[i] )
  24.             {
  25.                 hashed[i] = sig[i];
  26.             }
  27.             else
  28.             {
  29.                 hashed[i] = 0;
  30.             }
  31.         }
  32.         else
  33.         {
  34.             hashed[i] = 0;
  35.         }
  36.     }
  37.  
  38.     hash = CRC32 ( (byte*)hashed, 32 );
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement