Page 2 of 2
Re: Creating SHA Encrypted Values
Posted: Sat Mar 11, 2017 12:21 am
by FourthWorld
mickpitkin92 wrote:I'm looking forward to seeing the messageDigest function get updated, hopefully it will have some clear documentation to help users figure out the correct syntax to generate say a SHA3 hash or other hash types.
The syntax noted in the pull request I linked to seems pretty straightforward for all types:
Re: Creating SHA Encrypted Values
Posted: Fri Mar 31, 2017 1:19 pm
by sphere
Very nice.
I'm just stepping into this encryption bussiness.
I want to change a program whcih stores now plain text to a database. But it's better to change some sensitive data into encrypted data.
My idea was : encrypt--->Base64 encode--->store into database (base64 so it becomes a string instead of binarydata, so no hassle with trailing zeros as i have read here and there)
then Read again for DB -->Base64 decode--->decrypt
Have to test some things
Re: Creating SHA Encrypted Values
Posted: Thu Jun 15, 2017 9:03 pm
by sphere
lc9 dp7 new sha released today
Re: Creating SHA Encrypted Values
Posted: Sun Nov 10, 2019 2:29 am
by SirWobbyTheFirst
So looking at the MessageDigest function, it does indeed spit out a digest of the data, but I was wondering how I would go about converting that into the alphanumeric string that you would get from Mark Smith's library or PHP.
For example, if I put Hello World into an online SHA256 generator, I get the string "A591A6D40BF420404A011733CFB7B190D62C65BF0BCDA32B57B277D9AD9F146E" and I honestly cannot remember how to convert a digest to the necessary string. It used to be in the dictionary for MD5Digest but has been taken out now.
Mike
Re: Creating SHA Encrypted Values
Posted: Sun Nov 10, 2019 2:42 am
by bogs
Max's wiki still has it. I often find the wiki faster than the current dictionary and in many cases, it has additional information added for the entries (in this case, 2 comments go much further into it
).
Re: Creating SHA Encrypted Values
Posted: Sun Nov 10, 2019 2:42 am
by FourthWorld
LC returns the raw binary form of values returned from hashes, but you can transform binary data into hex with the binaryDecode function:
Code: Select all
on mouseup
put HexHash("Hello World", "sha-256")
end mouseup
function HexHash pStr, pHashMethod
put messageDigest(pStr, pHashMethod) into tmp
get binaryDecode("H*", tmp, tHex)
return tHex
end HexHash