<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Building Browsergames - Latest Comments in Building Browsergames: Securing our hashes (PHP)</title><link>http://bbgames.disqus.com/</link><description></description><atom:link href="https://bbgames.disqus.com/building_browsergames_securing_our_hashes_php/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Wed, 24 Aug 2011 12:44:49 -0000</lastBuildDate><item><title>Re: Building Browsergames: Securing our hashes (PHP)</title><link>http://buildingbrowsergames.com/2008/07/15/securing-our-hashes-php/#comment-294491232</link><description>&lt;p&gt;Well, this post is 2 years old now, but still for those reading it now: this is not the proper way of storing salted hashes.&lt;/p&gt;&lt;p&gt;The real purpose of salt is to render hashes of the same password different from each other so that if two users have the same password their hashed values would still look different.&lt;/p&gt;&lt;p&gt;A proper implementation would add a random salt generated on the fly for each user, and store that value in a 'salt' column in the db.&lt;/p&gt;&lt;p&gt;Then you can compute the proper hash fetching the salt associated with the username, then joining it with the password the user typed in.&lt;/p&gt;&lt;p&gt;Disqus is too laggy today for me to write proper code, but i doubt anyone will be reading this anyway.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">ValerioDeCamillis</dc:creator><pubDate>Wed, 24 Aug 2011 12:44:49 -0000</pubDate></item><item><title>Re: Building Browsergames: Securing our hashes (PHP)</title><link>http://buildingbrowsergames.com/2008/07/15/securing-our-hashes-php/#comment-7216443</link><description>&lt;p&gt;Ah ok :).&lt;br&gt;Anyway, my salt (which I made before I read this thanks to the user comments on other pages) is short, and I probably do not need it anywhere else than on the login and register page. &lt;br&gt;Thanks for your reply!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">MrLollige</dc:creator><pubDate>Sat, 14 Mar 2009 14:05:48 -0000</pubDate></item><item><title>Re: Building Browsergames: Securing our hashes (PHP)</title><link>http://buildingbrowsergames.com/2008/07/15/securing-our-hashes-php/#comment-7215554</link><description>&lt;p&gt;The benefits of turning it into a configuration value aren't so much in&lt;br&gt;securing it, as they are in not repeating it everywhere - if your salt is&lt;br&gt;'thequickbrownfoxjumpedoverthelazydog', do you really want to type that&lt;br&gt;everytime you need it?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Luke</dc:creator><pubDate>Sat, 14 Mar 2009 13:12:13 -0000</pubDate></item><item><title>Re: Building Browsergames: Securing our hashes (PHP)</title><link>http://buildingbrowsergames.com/2008/07/15/securing-our-hashes-php/#comment-7214651</link><description>&lt;p&gt;you could(and probably should) turn the salt into a configuration parameter&lt;/p&gt;&lt;p&gt;Why? I mean, if I change the salt value (if someone figured it and modified his dictionary to it), noone would be able to login any more....&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">MrLollige</dc:creator><pubDate>Sat, 14 Mar 2009 12:13:10 -0000</pubDate></item><item><title>Re: Building Browsergames: Securing our hashes (PHP)</title><link>http://buildingbrowsergames.com/2008/07/15/securing-our-hashes-php/#comment-4077067</link><description>&lt;p&gt;It doesn't matter much, but it isn't necessary to nest the md5() function within mysql_real_escape_string() as you will never have to escape a hexadecimal string.&lt;/p&gt;&lt;p&gt;While it usually works regardless, HTTP/1.1 requires you to use an absolute URL in header redirects. Example from php manual below:&lt;/p&gt;&lt;p&gt;/* Redirect to a different page in the current directory that was requested */&lt;br&gt;$host  = $_SERVER['HTTP_HOST'];&lt;br&gt;$uri   = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');&lt;br&gt;$extra = 'mypage.php';&lt;br&gt;header("Location: http://$host$uri/$extra");&lt;br&gt;exit();&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Chris Hepner</dc:creator><pubDate>Sun, 30 Nov 2008 19:08:12 -0000</pubDate></item></channel></rss>