<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>salting</title>
        <description>is there some standard on how to salt passwords?
somthing like hashed = hash(salt+password)?
i have already seen hashed = hash(hash(salt)+hash(password)).
and my own invention:-) is

while (length(password)&amp;lt;20) password+=password;
hashed = hash(password);

how do you salt passwords and what method would you (not) recommend?</description>
        <link>http://sla.ckers.org/forum/read.php?15,19557,19557#msg-19557</link>
        <lastBuildDate>Sun, 19 May 2013 05:53:19 -0500</lastBuildDate>
        <generator>Phorum 5.2.15a</generator>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?15,19557,20912#msg-20912</guid>
            <title>Re: salting</title>
            <link>http://sla.ckers.org/forum/read.php?15,19557,20912#msg-20912</link>
            <description><![CDATA[Yep great thread I have a open mind and this has really helped in future web development thanks everyone :)]]></description>
            <dc:creator>Gareth Heyes</dc:creator>
            <category>Privacy</category>
            <pubDate>Tue, 26 Feb 2008 15:33:42 -0600</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?15,19557,20911#msg-20911</guid>
            <title>Re: salting</title>
            <link>http://sla.ckers.org/forum/read.php?15,19557,20911#msg-20911</link>
            <description><![CDATA[@gareth <br />
<br />
no, the only point of generating long, highly entropic salts is to complexify bruteforcing. remember that *anything* is breakable with enough time and/or computational power.<br />
<br />
if bob the evil h4x0r got your hashes and your salts, he will still have to compute a rainbow (best time/space tradeoff) for each and every salt+hash. with the whole keyspace if he cannot deduce it from out of the band means. that's a whole lotta more difficult, and should give you enough time to take action.<br />
<br />
the assumption of security being a destination is dangerous, because there is *no* magic bullet. at no time, under no circumstance (even if your data is made of a single disk sunk into concrete then into marianna's)<br />
<br />
we just make their work harder. the only problem is that the tradeoff between risk and usability is not linear. at first you take small steps (ie :properly configuring a firewall) and you thwart off 90% of attacks (ie : automated network level attacks) then you take a bigger step, for a much lower gain, enough still to thwart off kiddies. then another bigger one, lowering gain again. etc...<br />
<br />
<br />
so yes, using per-user, long, high entropy salts are a small step, for a huge gain (making the cracking of a large DB irrealistic. come on. 100GB rainbow per-user, for 10K users ? much simpler to do rubberhose cryptanalysis in the admin's face)<br />
<br />
i think kogir made an excellent writeup of the situation and concepts. your foo is strong as they say]]></description>
            <dc:creator>Malkav</dc:creator>
            <category>Privacy</category>
            <pubDate>Tue, 26 Feb 2008 15:26:39 -0600</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?15,19557,20899#msg-20899</guid>
            <title>Re: salting</title>
            <link>http://sla.ckers.org/forum/read.php?15,19557,20899#msg-20899</link>
            <description><![CDATA[kogir Wrote:<br />
&gt; right next to the users' password hashes.  This is<br />
&gt; effective even when the salts are known because<br />
&gt; any rainbow table an attacker creates will be<br />
&gt; valid only against a single user's password.  The<br />
&gt; point of a salt is to force the attacker to brute<br />
&gt; force each user's password individually, not to<br />
&gt; keep them from brute forcing a single password.<br />
<br />
The random salt is a good point and could be stored in the database but what happens when SQL injection occurs or an attacker gains access to the database? Surely the point of uniquely hashing a password is to prevent a password from being reversed and exposing other accounts that user has.]]></description>
            <dc:creator>Gareth Heyes</dc:creator>
            <category>Privacy</category>
            <pubDate>Tue, 26 Feb 2008 03:20:05 -0600</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?15,19557,20896#msg-20896</guid>
            <title>Re: salting</title>
            <link>http://sla.ckers.org/forum/read.php?15,19557,20896#msg-20896</link>
            <description><![CDATA[Gareth Heyes Wrote:<br />
-------------------------------------------------------<br />
&gt; @kogir<br />
&gt; <br />
&gt; How do you store per user salts? What happens when<br />
&gt; a new user is created? If the salts are stored in<br />
&gt; the database then I can see major problems with<br />
&gt; this method.<br />
&gt; <br />
&gt; I fail to understand why I'm missing the point<br />
&gt; please provide me with a link to a rainbow table<br />
&gt; that does MD5(MD5($password . RANDOMSALT)), you<br />
&gt; would need a pretty big table to store all that<br />
&gt; information.<br />
<br />
===========<br />
Random Salt<br />
===========<br />
I store random, per user salts in the database right next to the users' password hashes.  This is effective even when the salts are known because any rainbow table an attacker creates will be valid only against a single user's password.  The point of a salt is to force the attacker to brute force each user's password individually, not to keep them from brute forcing a single password.<br />
<br />
For example, given two users, A and B, with passwords Pa and Pb, I'll produce two random salts, Sra and Srb.  Using any hash algorithm I want, F(), I store password hashes Ha = F(Sra + Pa) and Hb = F(Srb + Pb) in the database for verification when authenticating A and B.<br />
<br />
When a user A logs in, I look up the salt (Sra) and compute F(Sra + &lt;provided password&gt;).  If F(Sra + &lt;provided password&gt;) matches what's in the database, the user is authenticated.<br />
<br />
Computing a rainbow table for user A would require me to compute F(Sra + &lt;password&gt;) for all passwords I wish to precompute.  This rainbow table would be useless in cracking user B's password because F(Sra + &lt;password&gt;) != F(Srb + &lt;password&gt;) for all values of &lt;password&gt;.<br />
<br />
It's true that attacking a single user's password is only as hard as brute forcing a single password, but all the effort expended in brute forcing A's password is useless in brute forcing B's password.<br />
<br />
===========<br />
Static Salt<br />
===========<br />
Using a static salt, Ss, would result in hashes of the form F(Ss + &lt;password&gt;) being stored in the database.  Ha would be F(Ss + Pa) and Hb would be F(Ss + Pb).  No matter how random Ss is when you first generate it, it's not random when used to compute Ha and Hb.  If Pa == Pb, then Ha == Hb, and a rainbow table attack is now useful.  You can now find users with the same password hashes and crack them all at the same time.<br />
<br />
This holds true even for F() = MD5(MD5(&lt;password&gt; + StaticSalt))<br />
<br />
=======<br />
Summary<br />
=======<br />
The only benefit a salt can provide is to force the attacker to treat each hash individually.  Even if Ha and Hb match, if a random, per user, salt is used, then Pa and Pb won't match.  Discovering Pa does not reveal Pb.<br />
<br />
With resources like Aamzon S3 and EC2, for a few thousand dollars I can make a rainbow table that completely covers hashes for typical length passwords, given Ss and F(), in under a week.  The mere fact that a rainbow table doesn't yet exist does not make static salts any less useless.  The goal is to make creating such a table intractable.<br />
<br />
It is possible to pick a hash function F() that is so computationally expensive that brute forcing a even a single user's password would be infeasible, but such functions are usually too burdensome to run on a web server handling reasonable traffic.<br />
<br />
I hope this makes sense.]]></description>
            <dc:creator>kogir</dc:creator>
            <category>Privacy</category>
            <pubDate>Tue, 26 Feb 2008 01:38:58 -0600</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?15,19557,20718#msg-20718</guid>
            <title>Re: salting</title>
            <link>http://sla.ckers.org/forum/read.php?15,19557,20718#msg-20718</link>
            <description><![CDATA[more than happy to be useful to you. i have been most impressed with the hackverlets :)]]></description>
            <dc:creator>Malkav</dc:creator>
            <category>Privacy</category>
            <pubDate>Tue, 19 Feb 2008 10:25:42 -0600</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?15,19557,20715#msg-20715</guid>
            <title>Re: salting</title>
            <link>http://sla.ckers.org/forum/read.php?15,19557,20715#msg-20715</link>
            <description><![CDATA[@Malkav<br />
<br />
Thanks for the feedback<br />
<br />
How are collisions relevant though? Surely that relates only to data verification because you can produce the same hash for different values. I was suggesting using a salt as well as a random pass of MD. But I'll defo take your advice thanks :)]]></description>
            <dc:creator>Gareth Heyes</dc:creator>
            <category>Privacy</category>
            <pubDate>Tue, 19 Feb 2008 03:24:10 -0600</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?15,19557,20714#msg-20714</guid>
            <title>Re: salting</title>
            <link>http://sla.ckers.org/forum/read.php?15,19557,20714#msg-20714</link>
            <description><![CDATA[Gareth Heyes Wrote:<br />
-------------------------------------------------------<br />
&gt; Please stop reading if this is too paranoid for<br />
&gt; you :P....<br />
&gt; <br />
&gt; Thinking about this a bit more I think the ideal<br />
&gt; method would be to use the username  and a salt<br />
&gt; then a random amount of MD5 (or other hashing<br />
&gt; algorithm) My thinking behind this is that it is<br />
&gt; then difficult for an attacker to reproduce the<br />
&gt; sequence without access to the code (and then it's<br />
&gt; pretty much game over).<br />
&gt; <br />
&gt; When I mention random I mean a fixed method based<br />
&gt; on each site so for example site1 may use<br />
&gt; MD5(MD5(MD5(username . salt . password))), site2<br />
&gt; may use MD5(MD5(salt . password . username) etc,<br />
&gt; Now even with a large amount of computing power<br />
&gt; and time it becomes very hard to construct a<br />
&gt; rainbow table.<br />
<br />
please gareth, please. attacker not having access to your algorithm is a most naive approach. and as to the pseudorandom multiple pass md5, i don't think it's a really sensible approach, here's why :<br />
<br />
1 : if the user still has to use his credentials, the auth algorithm will have to know the number of md5 pass, meaning you'll have to persistently stock the information, rendering it vulnerable in the same way as the original salting technique<br />
<br />
2 : relying on the secret of the algorithm to preserve the security of the output has traditionnaly been a bad idea (cf A5/1).<br />
<br />
for a cryptographer, MD5 is broken. between collisions and birthday attack, both which are computationally feasible fairly easily (birthday being less pratical), your hash has few chance to survive on teh interweb.<br />
<br />
if your authentication method is strictly password centric (monofactor) then i would recommend that you use classic salting method, relying on a pseudorandom nonce, factorial of multiple user-unique parameters, then a long hash function such as whirlpool. of course multiplying the number of bits is just a runaway. but that should keep your hash secure for the few years to come (unless some guy find a good, non NP-complete way to factorize large integers. but then we'll have *much* more problems than a few hash broken)<br />
<br />
this will do the trick for enduser app, but then i'll recommand a much more macho method for heavyweight access. two factor is way cool, but three factor (smartcard, overly long pin, and biometric checks. have, know, is.) with a bunch of overly large, unfriendly, stupid and loyal to  the death guys.<br />
<br />
oh the NSA called btw, they want their paranoia back. now.]]></description>
            <dc:creator>Malkav</dc:creator>
            <category>Privacy</category>
            <pubDate>Tue, 19 Feb 2008 03:01:15 -0600</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?15,19557,20688#msg-20688</guid>
            <title>Re: salting</title>
            <link>http://sla.ckers.org/forum/read.php?15,19557,20688#msg-20688</link>
            <description><![CDATA[Hehe i like this paranoid stuff ;)<br />
<br />
So you can use a per page salt (stored in defines or something similiar) rather than a per page method. Or combine both of them<br />
Or you can merge 2 (salted or anything else) MD5 substrings to obfuscate the used algorithm or something similiar ^^]]></description>
            <dc:creator>The-Wildcat</dc:creator>
            <category>Privacy</category>
            <pubDate>Mon, 18 Feb 2008 15:16:43 -0600</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?15,19557,20672#msg-20672</guid>
            <title>Re: salting</title>
            <link>http://sla.ckers.org/forum/read.php?15,19557,20672#msg-20672</link>
            <description><![CDATA[So for example :-<br />
<br />
Password : test<br />
Salt : 123<br />
<br />
8ddee7c48c3ad374e14c08d9c2502aeb<br />
<br />
I've hashed the value with a certain amount of MD5's and a special sequence]]></description>
            <dc:creator>Gareth Heyes</dc:creator>
            <category>Privacy</category>
            <pubDate>Mon, 18 Feb 2008 05:51:04 -0600</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?15,19557,20671#msg-20671</guid>
            <title>Re: salting</title>
            <link>http://sla.ckers.org/forum/read.php?15,19557,20671#msg-20671</link>
            <description><![CDATA[Please stop reading if this is too paranoid for you :P....<br />
<br />
Thinking about this a bit more I think the ideal method would be to use the username  and a salt then a random amount of MD5 (or other hashing algorithm) My thinking behind this is that it is then difficult for an attacker to reproduce the sequence without access to the code (and then it's pretty much game over).<br />
<br />
When I mention random I mean a fixed method based on each site so for example site1 may use MD5(MD5(MD5(username . salt . password))), site2 may use MD5(MD5(salt . password . username) etc, Now even with a large amount of computing power and time it becomes very hard to construct a rainbow table.]]></description>
            <dc:creator>Gareth Heyes</dc:creator>
            <category>Privacy</category>
            <pubDate>Mon, 18 Feb 2008 05:47:45 -0600</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?15,19557,20660#msg-20660</guid>
            <title>Re: salting</title>
            <link>http://sla.ckers.org/forum/read.php?15,19557,20660#msg-20660</link>
            <description><![CDATA[@fragge<br />
<br />
Cool I like that method :)]]></description>
            <dc:creator>Gareth Heyes</dc:creator>
            <category>Privacy</category>
            <pubDate>Mon, 18 Feb 2008 02:35:39 -0600</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?15,19557,20658#msg-20658</guid>
            <title>Re: salting</title>
            <link>http://sla.ckers.org/forum/read.php?15,19557,20658#msg-20658</link>
            <description><![CDATA[Gareth Heyes Wrote:<br />
-------------------------------------------------------<br />
&gt; @kogir<br />
&gt; <br />
&gt; How do you store per user salts? What happens when<br />
&gt; a new user is created? If the salts are stored in<br />
&gt; the database then I can see major problems with<br />
&gt; this method.<br />
&gt; <br />
&gt; I fail to understand why I'm missing the point<br />
&gt; please provide me with a link to a rainbow table<br />
&gt; that does MD5(MD5($password . RANDOMSALT)), you<br />
&gt; would need a pretty big table to store all that<br />
&gt; information.<br />
<br />
I would assume he would create a hash using the username and a salt or some other value, and then use that as part of his salt, thus making that salt unique to that user (at least in that part of the salt). Then when he goes about decrypting it, he just converts the bit of the salt that was hashed username back into a user, and if it corresponds to the user that is trying to log, then it is the correct salt. No need to store salts, can all be done at runtime.]]></description>
            <dc:creator>fragge</dc:creator>
            <category>Privacy</category>
            <pubDate>Sun, 17 Feb 2008 23:14:58 -0600</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?15,19557,20639#msg-20639</guid>
            <title>Re: salting</title>
            <link>http://sla.ckers.org/forum/read.php?15,19557,20639#msg-20639</link>
            <description><![CDATA[@kogir<br />
<br />
How do you store per user salts? What happens when a new user is created? If the salts are stored in the database then I can see major problems with this method.<br />
<br />
I fail to understand why I'm missing the point please provide me with a link to a rainbow table that does MD5(MD5($password . RANDOMSALT)), you would need a pretty big table to store all that information.]]></description>
            <dc:creator>Gareth Heyes</dc:creator>
            <category>Privacy</category>
            <pubDate>Sun, 17 Feb 2008 07:08:03 -0600</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?15,19557,20636#msg-20636</guid>
            <title>Re: salting</title>
            <link>http://sla.ckers.org/forum/read.php?15,19557,20636#msg-20636</link>
            <description><![CDATA[@Gareth Heyes<br />
<br />
You're missing the point.  The goal of properly implemented salting is to make *creating* a rainbow table intractable.<br />
<br />
If I use sufficiently long and random *per user* salts, I can make it such that you have to start over and brute force each user's password by itself.  None of the work done to crack user A's password can be reused to help crack user B's password.<br />
<br />
See examples under http://en.wikipedia.org/wiki/Salt_%28cryptography%29<br />
<br />
If you're looking for a good standardized password hashing algorithm, I recommend the key derivation functions in PKCS#5 v2.1 ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-5v2/pkcs5v2_1.pdf]]></description>
            <dc:creator>kogir</dc:creator>
            <category>Privacy</category>
            <pubDate>Sun, 17 Feb 2008 03:03:46 -0600</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?15,19557,20153#msg-20153</guid>
            <title>Re: salting</title>
            <link>http://sla.ckers.org/forum/read.php?15,19557,20153#msg-20153</link>
            <description><![CDATA[@rsnake<br />
<br />
That's the idea making a double hash + salt it's very unlikely that a rainbow table will exist.]]></description>
            <dc:creator>Gareth Heyes</dc:creator>
            <category>Privacy</category>
            <pubDate>Sun, 03 Feb 2008 04:56:53 -0600</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?15,19557,20143#msg-20143</guid>
            <title>Re: salting</title>
            <link>http://sla.ckers.org/forum/read.php?15,19557,20143#msg-20143</link>
            <description><![CDATA[That only works because no one has built a rainbow table with double MD5 hashes.  So it's good for newbies, but if they know which hashing algo you use (which is often the case if they can get the password files/database), and they are at all motivated, it's just a matter of computational time to compute one, or compute a table based on common passwords.<br />
<br />
The point of a salt is to make it not just unique but unique per hash.  So that if it's ever compromised a rainbow table would have to be constructed for each possible salt as well (per hash).  That makes it exponentially larger and more difficult to compute.]]></description>
            <dc:creator>rsnake</dc:creator>
            <category>Privacy</category>
            <pubDate>Sat, 02 Feb 2008 22:12:38 -0600</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?15,19557,19783#msg-19783</guid>
            <title>Re: salting</title>
            <link>http://sla.ckers.org/forum/read.php?15,19557,19783#msg-19783</link>
            <description><![CDATA[@DoctorDan<br />
<br />
Finding a collision wouldn't matter for brute forcing password because the point of MD5 twice + salt is making the hash difficult to use in a rainbow table.]]></description>
            <dc:creator>Gareth Heyes</dc:creator>
            <category>Privacy</category>
            <pubDate>Sat, 19 Jan 2008 17:46:28 -0600</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?15,19557,19780#msg-19780</guid>
            <title>Re: salting</title>
            <link>http://sla.ckers.org/forum/read.php?15,19557,19780#msg-19780</link>
            <description><![CDATA[I don't think doing two MD5s helps at all.  If you're bruteforcing (without a dictionary), you're bound to find a collision no matter how many times you hash it.  Granted, it won't be the same password- but it will work in your system.<br />
<br />
-Dan<br />
<br />
Someone please correct me if I'm wrong on this, by the way!]]></description>
            <dc:creator>DoctorDan</dc:creator>
            <category>Privacy</category>
            <pubDate>Sat, 19 Jan 2008 16:29:13 -0600</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?15,19557,19682#msg-19682</guid>
            <title>Re: salting</title>
            <link>http://sla.ckers.org/forum/read.php?15,19557,19682#msg-19682</link>
            <description><![CDATA[why would this be safer than a pseudo-random string?]]></description>
            <dc:creator>nEUrOO</dc:creator>
            <category>Privacy</category>
            <pubDate>Tue, 15 Jan 2008 08:17:32 -0600</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?15,19557,19595#msg-19595</guid>
            <title>Re: salting</title>
            <link>http://sla.ckers.org/forum/read.php?15,19557,19595#msg-19595</link>
            <description><![CDATA[Gareth Heyes Wrote:<br />
-------------------------------------------------------<br />
&gt; I prefer a large random salt and md5 twice:<br />
&gt; MD5(MD5($salt . $password))<br />
<br />
Yeah I use a 32-64 char mixed random salt and use SHA-512, of course that is overkill, but safest method I know =oP]]></description>
            <dc:creator>CrYpTiC_MauleR</dc:creator>
            <category>Privacy</category>
            <pubDate>Sat, 12 Jan 2008 20:37:09 -0600</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?15,19557,19587#msg-19587</guid>
            <title>Re: salting</title>
            <link>http://sla.ckers.org/forum/read.php?15,19557,19587#msg-19587</link>
            <description><![CDATA[I prefer a large random salt and md5 twice:<br />
MD5(MD5($salt . $password))]]></description>
            <dc:creator>Gareth Heyes</dc:creator>
            <category>Privacy</category>
            <pubDate>Sat, 12 Jan 2008 17:28:06 -0600</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?15,19557,19565#msg-19565</guid>
            <title>Re: salting</title>
            <link>http://sla.ckers.org/forum/read.php?15,19557,19565#msg-19565</link>
            <description><![CDATA[What about salting with Unicode chars?]]></description>
            <dc:creator>Anonymous User</dc:creator>
            <category>Privacy</category>
            <pubDate>Sat, 12 Jan 2008 04:54:47 -0600</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?15,19557,19557#msg-19557</guid>
            <title>salting</title>
            <link>http://sla.ckers.org/forum/read.php?15,19557,19557#msg-19557</link>
            <description><![CDATA[is there some standard on how to salt passwords?<br />
somthing like hashed = hash(salt+password)?<br />
i have already seen hashed = hash(hash(salt)+hash(password)).<br />
and my own invention:-) is<br />
<br />
while (length(password)&lt;20) password+=password;<br />
hashed = hash(password);<br />
<br />
how do you salt passwords and what method would you (not) recommend?]]></description>
            <dc:creator>majak</dc:creator>
            <category>Privacy</category>
            <pubDate>Fri, 11 Jan 2008 15:20:33 -0600</pubDate>
        </item>
    </channel>
</rss>
