>>>>> "Shanker" == Shanker Balan <[EMAIL PROTECTED]> writes:
Shanker> Hello: Suresh Ramasubramanian wrote,
>> > This is not plain MD5, its MD5 with an 8 char random
>> salt. "md5sum" > does not use random salts. Most password
>> hashing schemes use salt. > NTLM
>>
>> That's right.
>>
>> > Looking at the passwd file in Linux and FreeBSD 4.5, i dont
>> see any > differrence in the hashing scheme. Both the OSes
>> follow the same > convention - "$1$somesalt$hashedpassword".
>> On a bsd machine ... a weird mix of crypt and md5. Plain old
>> crypt() should produce 13 chars of output, not 34, as in a bsd
>> passwd field.
Shanker> I don't think so. This is what crypt(3) sez:
Shanker> <quote> If the salt begins with the string $digit$ then
Shanker> the Modular Crypt Format is used.
Shanker> [..]
Shanker> Currently supported algorithms are:
Shanker> 1. MD5 2. Blowfish </quote>
Shanker> This is the case in Linux also.
Don't know if that `standard' Linux distributions support Blowfish
encryption for password. Though it's true, as far as I know the $n$
string at the beginning is supposed to tell the password matching
routine which algorithm to use to hash the user-supplied string.
Shanker> Then again, i think this password hashing business is all
Shanker> screwed up.
Shanker> For example, on my recompiled slapd with --tls, auth
Shanker> fails if i use "$1$somesalt$therest" passwords in the
Shanker> userPassword attribute. Without TLS, the same hash works
Shanker> for authentication.
Umm, I very much doubt that it's due to different routines -- such an
issue would have been noticed and solved years ago. What's more
likely is that compiling TLS in changed the default auth method. Just
a guess.
Shanker> Apparently, the Linux glibc crypt() function is not
Shanker> exactly the same as the OpenSSL crypt() function,
Shanker> depending on the order in which you link -lcrypto and
Shanker> -lcrypt, you might end up with strange results.
Shanker> Sadly, I cant read C code to ascertain for myself! :(
I can, but reading OpenSSL code wouldn't be my favourite way of
spending a few hours :-)
Shanker> As i understand it:
Shanker> - Plain crypt is MD5 with a 2 char salt. This is what the
Shanker> PHP (and Perl IIRC) crypt function provides if no salt is
Shanker> passed to the function.
crypt(3) uses a 2-character salt, as you say, and DES, not MD5 as the
hashing algorithm. OpenSSL has a set of DES routines which can run in
MIT (presumably traditional) crypt compatibility mode. IAC, the
passwords you have ($n$salt$password) are definitely MD5, not crypt
passwords.
Shanker> - Linux/FreeBSD style password hashes use $1$ and an 8
Shanker> char salt. Depending on the salt, the Perl/PHP crypt
Shanker> functions hashed output will change.
>> $1$eYrvxTAm$Wz4Wkxe5exy/5VhkuTnYH0 for example - 34 chars long,
>> so neither base64 nor hex. So, when you try using courier imap
>> or vpop3d on linux with (say) exim on linux ... and try to
>> verify courier passwords by throwing them at crypt().
Shanker> I don't think that will work. You will have to throw in
Shanker> the salt part to the crypt function as well.
Uh, these are MD5 hashes and as such not compatible with crypt. Use
the OpenSSL MD5 functions to hash and base64 to convert to ASCII. The
hash is actually the MD5 hash converted to base64.
Shanker> $1$ + samesalt + cleartext password =
Shanker> $1$somesalt$therest
Shanker> You will _always_ get the same hash if the salt and the
Shanker> clear text string are constant.
>> $1 = md5, $2 = blowfish (on openbsd).
Shanker> Yes.
>> After that, there's a separator from the data. Then there's
>> salt, till the third $, followed by the hashed and base64
>> encoded password
Shanker> Basically, the leading $1$ is the answer. if hash begins
Shanker> with a $1$, then its MD5 crypt with a 8 char salt. This
Shanker> _should_ be the same on all implementations (but its not
Shanker> like in my slapd+tls case).
Shanker> One way to settle this, run "john" against the password
Shanker> files! :-D
Shanker> John against Debian shadow file:
Shanker> su-2.05a# john /mnt/deb-root/etc/shadow Loaded 3
Shanker> passwords with 2 different salts (FreeBSD MD5 [32/32])
Shanker> john against FreeBSD 4.5:
Shanker> su-2.05a# john /etc/master.passwd Loaded 2 passwords with
Shanker> 2 different salts (FreeBSD MD5 [32/32])
Shanker> John sez that both are "FreeBSD MD5 [32/32]". Settled?
Shanker> :-D
Shanker> -- Shanu
Regards,
-- Raju
--
Raju Mathur [EMAIL PROTECTED] http://kandalaya.org/
It is the mind that moves
_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/linux-india-help