SHA1CryptoServiceProvider changed in .NET 4

Posted by WebDude on Stack Overflow See other posts from Stack Overflow or by WebDude
Published on 2010-05-31T20:40:39Z Indexed on 2010/05/31 20:43 UTC
Read the original article Hit count: 235

Filed under:
|
|

I am currently trying to upgrade a project of mine from .NET 3.5 to .NET 4.0

Everything was going really well, all code compiled, all tests passed.
Then I hit a problem deploying to my stagomg environment.
Suddenly my logins were no longer working.

It seems my SHA1 hashed passwords are being hashed differently in .NET 4.

I am using the SHA1CryptoServiceProvider:

SHA1CryptoServiceProvidercryptoTransformSHA1 = new SHA1CryptoServiceProvider();

To test I created a new Visual Studio project with 2 console applications.
The first targeted at .NET Framework 3.5 and the second at 4.0.
I ran exactly the same hashing code in both and different results were produced.

Why is this happening and how can I fix this?
I obviously cannot go update all of my users passwords considering I do not know what they are.

Any help would be greatly appreciated.

© Stack Overflow or respective owner

Related posts about cryptography

Related posts about .net-4.0