|
Message-ID: <99ac148b52304486968956b7c4b5f2ac@smtp.hushmail.com> Date: Sat, 16 Feb 2013 00:32:32 +0100 From: magnum <john.magnum@...hmail.com> To: "john-dev@...ts.openwall.com" <john-dev@...ts.openwall.com> Subject: AIX password hashes I have a feeling the "hard" part of figuring out the AIX hashes is to establish the exact encoding scheme. We know that the normal crypt(3) alphabet is used as opposed to MIME Base64. Solar apparently also established that '.' is zero although I'm too thick to follow. My problem is I never really understood crypt(3)'s base 64 encoding in the first place. Here's code from our MD5 binary(): #define TO_BINARY(b1, b2, b3) \ value = \ (MD5_word)atoi64[ARCH_INDEX(pos[0])] | \ ((MD5_word)atoi64[ARCH_INDEX(pos[1])] << 6) | \ ((MD5_word)atoi64[ARCH_INDEX(pos[2])] << 12) | \ ((MD5_word)atoi64[ARCH_INDEX(pos[3])] << 18); \ pos += 4; \ out.b[b1] = value >> 16; \ out.b[b2] = value >> 8; \ out.b[b3] = value; ... TO_BINARY(0, 6, 12); TO_BINARY(1, 7, 13); TO_BINARY(2, 8, 14); TO_BINARY(3, 9, 15); TO_BINARY(4, 10, 5); out.b[11] = (MD5_word)atoi64[ARCH_INDEX(pos[0])] | ((MD5_word)atoi64[ARCH_INDEX(pos[1])] << 6); So the very first output byte is constructed by the first and part of the second input character. I guess that is just like MIME would do it. But the next byte produced is placed in the 6th output byte. Why? CryptSHA256 use the same TO_BINARY macro but this main loop: do { TO_BINARY(i, (i+10)%30, (i+20)%30); i = (i+21)%30; } while (i != 0); value = (ARCH_WORD_32)atoi64[ARCH_INDEX(pos[0])] | ((ARCH_WORD_32)atoi64[ARCH_INDEX(pos[1])] << 6) | ((ARCH_WORD_32)atoi64[ARCH_INDEX(pos[2])] << 12); out[31] = value >> 8; \ out[30] = value; \ And CryptSHA512 use this: do { TO_BINARY(i, (i+21)%63, (i+42)%63); i = (i+22)%63; } while (i != 21); value = (ARCH_WORD_32)atoi64[ARCH_INDEX(pos[0])] | ((ARCH_WORD_32)atoi64[ARCH_INDEX(pos[1])] << 6) | ((ARCH_WORD_32)atoi64[ARCH_INDEX(pos[2])] << 12); out[63] = value; If this is an IQ test, I fail it. Is there a canonical logic that connects all three of the above that could make you "know" how to produce, say, a 20 byte SHA-1 binary the same way? Oh and yes, I wrote the crypt sha formats - but iirc I just brute forced the order of TO_BINARY from knowing how it should end up. The current code with loop and modulus was put there by Jim, who apparently got some more clue :) magnum
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.