Hi Sandip, Shridhar,

Couple of things to note:

1.  The MD5 passwords in Redhat /etc/shadow are base64 encoded.

2.  The format of the password is:

    $type$salt$password

    type: 1 -- MD5 encrypted.  Presumably other encryption schemes will
        use $2, $3, etc.

    salt -- 8-character salt used to permute the MD5 algorithm.

    password -- the base64 of the actual MD5 hash.

3.  Here's the easiest way I found to make an RH-compatible MD5
    password:

    perl -MCPAN -e 'install Crypt::PasswdMD5' (just once)
    perl -e 'use Crypt::PasswdMD5 ; print Crypt::PasswdMD5::unix_md5_crypt "plaintext" 
, time() % 100000000'

    (line may have wrapped).  Should be trivial to modify this to do
    whatever you want with it.

Regards,

-- Raju

>>>>> "Shridhar" == Shridhar Daithankar <[EMAIL PROTECTED]> writes:

    Shridhar> Hi I fI am not making a mistake there is difference
    Shridhar> between md5 checksm and md5 encryption. You could use
    Shridhar> crypt() perhaps...

    Shridhar> Not very sure...

    Shridhar> Bye Shridhar

    Shridhar> Sandip Bhattacharya wrote:

    >> Redhat by default uses md5 encrypted shadow passwords. Now we
    >> ran into a particular problem in which we have to read the
    >> shadow file and authenticate users.(No we don't want to use the
    >> passwd C libraries)
    >> 
    >> I noticed a weird thing. Isn't MD5 strings supposed to be in
    >> hexadecimal? The shadow file passwords are not so.
    >> 
    >> I tried a small experiment. I put the password of a known
    >> person in a text file (without newline) and run md5sum on
    >> it. The hash had nothing in common with the /etc/shadow
    >> equivalent. What am i doing wrong?
-- 
Raju Mathur          [EMAIL PROTECTED]           http://kandalaya.org/

----------------------------------------------
An alpha version of a web based tool to manage
your subscription with this mailing list is at
http://lists.linux-india.org/cgi-bin/mj_wwwusr

Reply via email to