Okay, so this might get a little long but any help on this one would be much appreciated!
Our current web app uses the Framework 1.1 and the following code to hash out our passwords for authentication.
using System.Security.Cryptography;
using System.Text;
public static string HashPassword(
Guid salt,
string password)
{
SHA1 hash =
SHA1.Create();
ASCIIEncoding encoder =
new ASCIIEncoding();
byte[] combined = encoder.GetBytes(salt + password);
hash.ComputeHash(combined);
return encoder.GetString(hash.Hash);
}
I have since converted our app to the Framework 2.0 without touching any of the above code. However, I can not log in! It seems that the computed hash is different in 2.0 than 1.1. After doing some research I have found articles talking about setting up the <machinekey></machinekey> config in a web.config, but of course our 1.1 app used the default of "AutoGenerate"...although I am still confused on this one; we used this configuration on our dev boxes and on production...so if the validationkey needed to be the same on all boxes why did it not break in 1.1 between boxes?
Here are the two results of hashing the word "dog" in the different frameworks. Displayed are the first few char values.
SHA1 hash of "dog" in 1.1: 100 21 18 82 79 71 52 * * * * * * * * * * * * *
SHA1 hash of "dog" in 2.0: 63 63 18 82 79 71 63 * * * * * * * * * * * * *
So what I'm thinking is 1 of 3 things:
1. The "AutoGenerate" is calculated differently in 1.1 than 2.0 and im going to have to build a 1.1 authentication service to authenticate user on our converted 2.0 app.
2. There is some way for me to get the auto generated validation key out from the 1.1 app, put it into the web.config of the 2.0 app and go on living a happy fullfilled life.
3. The <machinekey> has nothing to do with this issue, its something else completly.
4. (Yeah, i know i said "1 of 3") I'm dumb, have no idea what I'm talking about and should go live in the woods where a person like myself would feel more "comfortable".
*wishing for #2*
Anyways, has anyone else run into this issue, or got a great idea for me?
Thanks,
Joe
P.S. I know I can't spell