@Jacque: how do we get a hash from the encrypt command?
@ittarter: Jacque's right about moving beyond md5 for hashing. It's useful for certain sorting tasks, but no longer considered a good cryptographic hash.
Slightly better is LC's sha1Digest function, but it's only slightly better. Both md5digest and sha1Digest return binary values, which you could convert to hex with something like this:
Code: Select all
function CleanHash s
put sha1Digest(s) into tHash
get binaryDecode("h*",tHash, tCleanHash)
return tCleanHash
end CleanHash
But again, neither of those two algorithms are particularly strong.
You'll probably want to use sha256. I've submitted a request to have that included in the engine, but in the meantime one of our community members, the late great Mark Smith, put together a nice library for that and more here:
http://marksmith.on-rev.com/revstuff/fi ... h-Hmac.zip
Even better, although he does provide an sha25Digest function that returns a binary form as LC's hash functions do, he also provides one to get the hex form directly:
Of course even the best hash algo won't be very safe without good salting. There are many useful articles about current salting methods; this one seems pretty good:
https://www.codeproject.com/Articles/70 ... g-it-Right
For a quick way to generate unique salt strings of a reasonable length see the uuid function.