Erik Porter's Blog

Life and Development at Microsoft and Other Technology Discussions

News

    Upgrade Password Hashing From .NET 1.1 to .NET 2.0

    If you're having troubles upgrading your ASP.NET 1.1 app to 2.0 because of hashing your passwords "not working", my long time friend, Joe, figured it out.
    Posted: Nov 29 2005, 03:07 PM by HumanCompiler | with 4 comment(s)
    Filed under: ,

    Comments

    Jason Mauss said:

    I've always used that method "HashPasswordForStoringInConfigFile" to hash stuff (after adding a salt of course). It doesn't get much easier than that.
    # November 29, 2005 6:52 PM

    Erik Porter said:

    So have I, but isn't that doing the same thing he was doing?

    Personally I always specify the encryption key in my application so it's not an issue.
    # November 29, 2005 6:55 PM

    Jason Mauss said:

    "isn't that doing the same thing he was doing?"

    Unless I misunderstood that thread - his problem stemmed from using ASCII encoding instead of Base64. If you open Reflector on the System.Web.Security.HashPasswordForStoringInConfigFile method you'll see that, even though it uses UTF-8 encoding for the byte array initially, it returns a hex string from the byte array, rather than a UTF-8 or ASCII encoded string.

    Not that his eventual solution doesn't work or isn't "right" - it's just that, as I think one guy in that thread pointed out, it's much easier to use the built in method that System.Web.Security holds.

    And yes, this reply is this long because I'm bored at work and need some intellectual stimulation. :-p
    # November 29, 2005 7:34 PM

    Erik Porter said:

    Gotchya. I'd never opened it up in Reflector...cool!
    # November 29, 2005 7:36 PM