RE: Values to use for a salt?

From: Fletcher, Stephen J (stephen.fletcher_at_eds.com)
Date: 12/19/03

  • Next message: Mark Burnett: "RE: Values to use for a salt?"
    To: secprog@securityfocus.com
    Date: Fri, 19 Dec 2003 17:09:34 +1100
    
    

    How does an md5 crypt style hash store the salt? ie. the password hashes
    that begin with $1$
    If you use a large salt such as 32 characters does the entire salt get used
    or only a part of it?

    -----Original Message-----
    From: Brian Hatch [mailto:bri@ifokr.org]
    Sent: Friday, 19 December 2003 7:09 AM
    To: Scott Cleven-Mulcahy
    Cc: secprog@securityfocus.com; marian.ion@e-licitatie.ro
    Subject: Re: Values to use for a salt?

    > On a related note, earlier someone asked if it was advisable to use the
    > user's account name as the salt value. The answer is no. To be
    effective,
    > the salt value should be kept secret. In essence, what we're talking
    about
    > are HMACs (hashed method authentication codes). HMACs are only as good as

    > the secrecy of the key - and account names are not secret.

    Salts should be completely random. Always.

    Should salts be secret? Maybe it depends on the system, but if
    you take unix password hashing, salts are *NEVER* secret:

            $ perl -e 'print crypt( "my pass", "salt" ), "\n"'
            saTFlq8BYSMRY

    In this case we're using a DES-style hash, with a salt 'salt'.
    Salts for this form of crypt are actually only two characters
    long, so the salt is really just 'sa'.

    Note the first two letters of the resulting hash: 'sa'.
    The salt is stored as part of the result.

    To check, a password, you'd use this:

            # the hashed password, as snagged from /etc/shadow, etc
            $hash='saTFlq8BYSMRY';

            # the password to try, as snagged from the user
            $pass="my pass";

            if ( crypt($pass,$hash) eq $hash ) {
                    print "Yes, they're the same\n"
            }

    There's no way to verify a password unless you know the salt,
    which is always the first two characters of the hashed password
    (hense using '$hash' as the second argument to crypt above.)

    The salt needs to be stored somewhere, and needs to be available
    to the password checking routine. It doesn't necessarily need
    to be in the hash result itself, but it needs to be somewhere.

    --
    Brian Hatch                  "The secret of our marriage's
       Systems and                success, Londo, is our lack of
       Security Engineer          communication.  You've jeopardised
    http://www.ifokr.org/bri/     that success and I would know why."
    Every message PGP signed
    

  • Next message: Mark Burnett: "RE: Values to use for a salt?"

    Relevant Pages

    • Re: Is this secure
      ... What I do in my business layer I get the salt, then I use my custom classes ... to hash the passed in password then send the Hash to a Stored Proc to ... Both the hashed password and salt are stored in the database. ... but then i'd need the salt to create a saltedhash to ...
      (microsoft.public.dotnet.framework.aspnet)
    • Re: Best Way To Randomize/Salt A Text String Before SHA256?
      ... In principle, as long as your hash function is secure, all you need to ... If the user can store a fairly long secret salt, the ... since brute force attacks become infeasible. ...
      (sci.crypt)
    • Re: Can Kerberos be cracked??
      ... Subject: Can Kerberos be cracked?? ... A "salt" is a "random" value that is appended to the ... possible for you to dictionary-crack my password unless you know the ... >> In order to get the hash you would need to launch a brute force attack ...
      (Focus-Microsoft)
    • Re: Is this secure
      ... I use SHA1 to hash my passwords. ... Both the hashed password and salt are stored in the database. ... but then i'd need the salt to create a saltedhash to compare ...
      (microsoft.public.dotnet.framework.aspnet)
    • Re: Is this secure
      ... I use SHA1 to hash my passwords. ... Both the hashed password and salt are stored in the database. ... but then i'd need the salt to create a saltedhash to compare ...
      (microsoft.public.dotnet.framework.aspnet)