|
SynopsisPerform a simple one way hash on a passed in string value. This is a good way to obfuscate data. For example, if you wish to store a user name and password. You can store password by passing the value through the hash function first, then storing the hashed value. Then when you want to verify a user, you ask for their pwd and run their input through the hash function to perform the lookup varification of the user name and pwd given. CODE ' Hash
' http://www.utteraccess.com/wiki/index.php/Hash ' Code courtesy of UtterAccess Wiki ' Licensed under Creative Commons License ' http://creativecommons.org/licenses/by-sa/3.0/ ' ' You are free to use this code in any application, ' provided this notice is left unchanged. ' ' rev date brief descripton ' 1.0 2011-04-15 ' Public Function Hash(ByVal strHashThis As String) As Long Dim i As Long, h As Long Dim lngTemp As Long h = Len(strHashThis) For i = 1 To h lngTemp = (Asc(Mid$(strHashThis, h - i + 1, 1)) + Asc(Mid$(strHashThis, i, 1))) Xor lngTemp Next i Rnd -1 Randomize lngTemp Hash = (Rnd() * &H7FFFFFFF) And &HFFFFFFFF End Function
|
| This page was last modified 13:13, 18 January 2012. This page has been accessed 580 times. Disclaimers |