void __stdcall sub_keytomd5(int KeySize, void *Keybase)
{
int X;
unsigned __int8 Byte_Bit_1_0;
signed int j;
int testSize;
void *Tempoffset;
void *Tempbase;
signed int i;
Tempbase = operator new(KeySize);
memset(Tempbase, 0, KeySize);
for ( i = 0; i < KeySize; ++i ) // from 0 to keysize
{
Tempoffset = Tempbase; // tempbase start
testSize = 7 - i;
while ( testSize < 0 )
{
testSize += 8; // testsize =7-i%8 then from 7 to 0
Tempoffset = (char *)Tempoffset + 1; // tempoffset=tempbase+i/8
}
for ( j = 7; j > -1; --j )
{
Byte_Bit_1_0 = (1 << j) & *((_BYTE *)Keybase + i);
if ( Byte_Bit_1_0 ) // 0 false 1 true
{
X = j - testSize;
if ( j - testSize >= 0 )
*(_BYTE *)Tempoffset += (signed int)Byte_Bit_1_0 >> X;
else
*(_BYTE *)Tempoffset += Byte_Bit_1_0 << abs(X);
}
if ( j > 0 )
{
testSize = testSize- KeySize; // from end =7-i%8-keysize
while ( testSize < 0 )
{
testSize += 8;
Tempoffset = (char *)Tempoffset + 1;
}
}
}
}
.............................................................................................
}