I am trying this … To store the password:
Dim Hash As String = Crypto.Hash(k, Crypto.Algorithm.SHA512)
rs.Edit
rs.Field(“UserPassword”).StringValue = Hash
rs.Update
To retrieve the password:
// User enters name in textfield1 and password in textfield2
Dim Hash1 As String = Crypto.Hash(textfield2.text, Crypto.Algorithm.SHA512)
Dim rs As RecordSet = DB.SQLSelect(“SELECT * FROM Users WHERE UserName = '”+textfield1.text+"’ "
Dim Hash2 As String = rs.Field(“UserPassword”).StringValue
So Hash1 = Hashed user input and Hash2 = retrieved password (should be Hashed from the password-store-code above)
Then I compare Hash1 to Hash2 and expect them to match - but they don’t.
Is there an obvious problem with what I am trying to accomplish?
You could be having conversion/encoding problems with the binary data. The Hash function returns a MemoryBlock. You might try expressing the Hash as a hexadecimal value before storing and comparing.
Since we’re going down this road, you should look into a scheme like Security Through Obesity to further protect the data, and also disallow weak password.
To that end, I have a class that checks passwords against the 10,000 most used and flags those that are similar, e.g., “y4nk3335” essentially spells out “yankees” and would be flagged. It also lets you set rules like “1 upper, 1 lower, 1 digit, 1, symbol, and must meet any three of those”.
These were part of my session materials from XDC but I can make them available separately if there is interest.
Although I’ll confess the first 30 times I looked at the title I did think to myself “Does Kem realize that’s not how you spell Obscurity?”
Then I blitzed through a few google pages & references and decided it was one I did want to sit in on & things just conspired to put me in the other session room at that time
Yeah, for a while I thought it was “obscurity” too.
And no problem about going to Bob’s session, I’m sure it was excellent. I mean, mine was mind-blowing and life-changing, and at least one person actually fainted, but I’m sure his was good too. sense of self worth expanding faster