Here's the deal: I'm moving the .NET site to Python. I have a password hash database using the System.Security.Cryptography.SHA1Managed utility.
I am creating a hash in .NET with the following code:
string hashedPassword = Cryptographer.CreateHash("MYHasher", userInfo.Password);
The MYHasher block is as follows:
<add algorithmType="System.Security.Cryptography.SHA1Managed, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=blahblahblah"
saltEnabled="true" type="Microsoft.Practices.EnterpriseLibrary.Security.Cryptography.HashAlgorithmProvider, Microsoft.Practices.EnterpriseLibrary.Security.Cryptography, Version=3.0.0.0, Culture=neutral, PublicKeyToken=daahblahdahdah"
name="MYHasher" />
So, for this password, I go back and save 48 bytes of salted sha1 in the database. I assume the last 8 bytes are salt. I tried to reproduce the hashing process in python by doing sha1 (salt + password) and sha1 (password + salt), but I had no luck.
My question to you:
- How are public keys used?
- How to recover a password using salt.
- How is salt created? (e.g. When I say saltEnabled = "true", what extra magic happens?)
, .NET, , .
!