<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Do not use string hashes for security purposes</title><link>http://blogs.msdn.com/ericlippert/archive/2005/10/24/do-not-use-string-hashes-for-security-purposes.aspx</link><description>A recent question I got about the .NET CLR's hashing algorithm for strings is apropos of our discussion from January on using salted hashes for security purposes. (If you missed it, you can read it here: Part One , Part Two , Part Three and Part Four</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Do not use string hashes for security purposes</title><link>http://blogs.msdn.com/ericlippert/archive/2005/10/24/do-not-use-string-hashes-for-security-purposes.aspx#484156</link><pubDate>Mon, 24 Oct 2005 18:47:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:484156</guid><dc:creator>Jonas Grumby</dc:creator><description>Wow.  It never even dawned on me that someone might do that.  And this was someone who had read your series?  Talk about understanding just enough to get it completely wrong.</description></item><item><title>re: Do not use string hashes for security purposes</title><link>http://blogs.msdn.com/ericlippert/archive/2005/10/24/do-not-use-string-hashes-for-security-purposes.aspx#484164</link><pubDate>Mon, 24 Oct 2005 19:03:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:484164</guid><dc:creator>Eric K.</dc:creator><description>Soo... what is the supposedly-painless alternative that we should be using instead?&lt;br&gt;&lt;br&gt;Roll our own algorithm and hope it behaves according to standards?&lt;br&gt;&lt;br&gt;Buy a third-part component?&lt;br&gt;&lt;br&gt;Hope we don't need standard behavior and don't expect upgrades?</description></item><item><title>re: Do not use string hashes for security purposes</title><link>http://blogs.msdn.com/ericlippert/archive/2005/10/24/do-not-use-string-hashes-for-security-purposes.aspx#484191</link><pubDate>Mon, 24 Oct 2005 19:49:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:484191</guid><dc:creator>Brian Delahunty</dc:creator><description>&amp;gt;Soo... what is the supposedly-painless alternative that we should be using instead? &lt;br&gt;&amp;gt;Roll our own algorithm and hope it behaves according to standards? &lt;br&gt;&amp;gt;Buy a third-part component? &lt;br&gt;&amp;gt;Hope we don't need standard behavior and don't expect upgrades? &lt;br&gt;&lt;br&gt;Plenty of standard hashing algos built into .NET... look in the System.Security.Cryptography namespace in 1.1 and you'll find the following (plus a few more):&lt;br&gt;&lt;br&gt;System.Security.Cryptography.MACTripleDES&lt;br&gt;System.Security.Cryptography.HMACSHA1&lt;br&gt;System.Security.Cryptography.MD5CryptoServiceProvider&lt;br&gt;System.Security.Cryptography.SHA1Managed&lt;br&gt;System.Security.Cryptography.SHA256Managed&lt;br&gt;System.Security.Cryptography.SHA384Managed&lt;br&gt;System.Security.Cryptography.SHA512Managed</description></item><item><title>re: Do not use string hashes for security purposes</title><link>http://blogs.msdn.com/ericlippert/archive/2005/10/24/do-not-use-string-hashes-for-security-purposes.aspx#484195</link><pubDate>Mon, 24 Oct 2005 19:59:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:484195</guid><dc:creator>G. Dog</dc:creator><description>I think there is some confusion here and you should probably point out WHICH methods specifically you are talking about.&lt;br&gt;&lt;br&gt;I think you are talking about calling GetHashCode() on a string, is that right? If so  then I understand this post... But it appears as in the question by Eric K. that you may be referring to some OTHER hashing methods when you say &amp;quot;the .NET string hashing algorithm&amp;quot; (a very vague statement).&lt;br&gt;&lt;br&gt;Please clarify...?&lt;br&gt;</description></item><item><title>re: Do not use string hashes for security purposes</title><link>http://blogs.msdn.com/ericlippert/archive/2005/10/24/do-not-use-string-hashes-for-security-purposes.aspx#484210</link><pubDate>Mon, 24 Oct 2005 20:29:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:484210</guid><dc:creator>Jonas Grumby</dc:creator><description>G. Dog: Follow the last link in the article.</description></item><item><title>re: Do not use string hashes for security purposes</title><link>http://blogs.msdn.com/ericlippert/archive/2005/10/24/do-not-use-string-hashes-for-security-purposes.aspx#484235</link><pubDate>Mon, 24 Oct 2005 21:08:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:484235</guid><dc:creator>Eric Lippert</dc:creator><description>* no, this was clearly not someone who had read my articles -- this was from a customer who had developed their own customer-secret hashing system. The question just got to me at random from a PSS guy.&lt;br&gt;&lt;br&gt;* The alternative you should be using instead is exactly what I said -- use SHA1 or MD5 or some other industry-standard algorithm designed for security purposes.  Make your own educated judgment as to what algorithm suits your purposes based on the characteristics of your problem and the algorithm in question.&lt;br&gt;&lt;br&gt;* Yes, I am talking about String.GetHashCode.  I apologize for the unclear text; I've clarified it.&lt;br&gt;&lt;br&gt;</description></item><item><title>re: Do not use string hashes for security purposes</title><link>http://blogs.msdn.com/ericlippert/archive/2005/10/24/do-not-use-string-hashes-for-security-purposes.aspx#485335</link><pubDate>Wed, 26 Oct 2005 23:50:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:485335</guid><dc:creator>Gabe</dc:creator><description>Is there some way, then (possibly using Reflection) to get the old behavior?&lt;br&gt;&lt;br&gt;I can easily imagine a situation where somebody has persisted a hash table (caching web pages with the filename being the URL's hash value in base64) and would want to keep the same behavior after upgrading to Whidbey.</description></item><item><title>re: Do not use string hashes for security purposes</title><link>http://blogs.msdn.com/ericlippert/archive/2005/10/24/do-not-use-string-hashes-for-security-purposes.aspx#485370</link><pubDate>Thu, 27 Oct 2005 00:49:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:485370</guid><dc:creator>Eric Lippert</dc:creator><description>Reflection isn't going to help you -- reflection just turns early-bound calls into late-bound calls, it doesn't change what the call does.&lt;br&gt;&lt;br&gt;If you are in this unfortunate predicament, the best advice I can give you is to get the Rotor sources, look up the string hash function, and re-implement it in the managed language of your choice.  Then start using your now-stable library function rather than String.GetHashCode.&lt;br&gt;&lt;br&gt;</description></item><item><title>re: Do not use string hashes for security purposes</title><link>http://blogs.msdn.com/ericlippert/archive/2005/10/24/do-not-use-string-hashes-for-security-purposes.aspx#485910</link><pubDate>Fri, 28 Oct 2005 02:07:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:485910</guid><dc:creator>Lance Fisher</dc:creator><description>One of my favorite function names:&lt;br&gt;&lt;br&gt;System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile()</description></item><item><title>When Breaking Changes Actually Break Stuff</title><link>http://blogs.msdn.com/ericlippert/archive/2005/10/24/do-not-use-string-hashes-for-security-purposes.aspx#539381</link><pubDate>Sun, 26 Feb 2006 08:22:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:539381</guid><dc:creator>protected virtual void jaysonBlog {</dc:creator><description>It&amp;amp;amp;rsquo;s funny how breaking changes actually&amp;amp;amp;hellip;well, break stuff sometimes.&amp;amp;amp;nbsp; I&amp;amp;amp;rsquo;ve had...</description></item><item><title>re: Do not use string hashes for security purposes</title><link>http://blogs.msdn.com/ericlippert/archive/2005/10/24/do-not-use-string-hashes-for-security-purposes.aspx#551484</link><pubDate>Tue, 14 Mar 2006 23:34:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:551484</guid><dc:creator>Elbie</dc:creator><description>If I understand correctly, the weaknesses in MD5 and SHA-1 are with respect to collisions, not preimages, and as long as those hashing algorithms remain preimage resistant, then there's really no problems with continuing to use them.</description></item><item><title>re: Do not use string hashes for security purposes</title><link>http://blogs.msdn.com/ericlippert/archive/2005/10/24/do-not-use-string-hashes-for-security-purposes.aspx#9011896</link><pubDate>Thu, 23 Oct 2008 02:18:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9011896</guid><dc:creator>Reinhard</dc:creator><description>&lt;p&gt;Gabe: there is a way to get the old functionality:&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://aspalliance.com/1218_NET_String_Hashing_The_Hidden_Knot.all"&gt;http://aspalliance.com/1218_NET_String_Hashing_The_Hidden_Knot.all&lt;/a&gt;&lt;/p&gt;
</description></item></channel></rss>