I have a C hashing function which I wish to convert to python.
But I am stumped on how to handle the DWORD mathematical operations like following snippets:
DWORD dwResult = 0
DWORD dwNumValid = strlen(chararray);
...
dwResult = (dwResult << 3) | (dwResult >> (sizeof(DWORD)*8 - 3));
dwResult += somechararray[position];
...
dwHashLocal = dwResult
while (dwHashLocal)
{
dwNewChar = dwHashLocal % dwNumValid;
....
dwHashLocal /= dwNumValid;
}
I tried playing with import ctypes
but am a total noob with byte conversions and operations.
Most of the errors are of sorts unsupported operand type(s) for %: 'c_ulong' and 'c_ulong'
Any pointers would be much appreciated