Frage

I'm just fiddling around with some setting to get to know the SimpleMembershipProvider better. Background info:

MVC 4, .Net 4.0 and Entity Framework. I'm also using the standard Internet Mvc Application(for convenience).

Problem/or question:

In the Web.config file i have set that the hashalgorithmType should be SHA512, but when i register a member the outcome in the database is only 68 characters long. The SHA512 should be 128 characters(a quick google).

Why is that? Some setting I need to change also? Or do i need to Override some "setpassword" method to explicitly use SHA512?

Or should I maybe use external sources e.g. Bcrypt and somehow integrate it my current solution?(in that case it would be kind if someone could point me in the right direction for further reading)

web.config Code:

<roleManager enabled="true" defaultProvider="SimpleRoleProvider">
      <providers>
        <clear/>
        <add name="SimpleRoleProvider" type="WebMatrix.WebData.SimpleRoleProvider, WebMatrix.WebData"/>
      </providers>
</roleManager>

<membership defaultProvider="SimpleMembershipProvider" hashAlgorithmType="SHA512">
      <providers>
        <clear/>
        <add name="SimpleMembershipProvider" type="WebMatrix.WebData.SimpleMembershipProvider, WebMatrix.WebData" />
      </providers>
</membership>
War es hilfreich?

Lösung

I do not believe you can change the hashing algorithm in SimpleMembership like you could in the older membership providers. The Answer in this QA describes the hashing algorithm used in SimpleMembership.

Since you are just starting to learn SimpleMembership I think I should mention that it has been depreciated for ASP.NET Identity. You may want to spend the time learning this instead since it is Microsoft's direction going forward. It is much more flexible and you can plug in any hashing algorithm you care to use.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top