md5Digest gives different results Mac vs Windows LC 9.5.1
monte at appisle.net
Sun Apr 19 20:26:39 EDT 2020
As Brian said LiveCode is not calculating different values on different platforms. You can’t just look at the output in a text field and compare though. The function returns binary data so needs to be hex encoded for cross platform comparison. If you put it into a field then LiveCode will do its normal binary data to string conversion which uses a different text encoding on each platform so it will look different in the field.
To compare cross platform use:
get binaryDecode("h*", messageDigest(textEncode("My very large data", "UTF-8"), "SHA3-256"), tHash); put tHash
> On 20 Apr 2020, at 10:14 am, Bill Vlahos via use-livecode <use-livecode at lists.runrev.com> wrote:
> The LiveCode Dictionary states:
> When generating a messageDigest for a string, it is a good idea to encode it to binary data using the textEncode <> function. Otherwise, the messageDigest could be different, depending on the platform <> on which your application is running.
> However, I tried their example in the Dictionary but it still gives different values on Macintosh vs. Windows:
> put textEncode("My very large data", "UTF-8") into tOriginal
> put messageDigest(tOriginal, "SHA3-256") into tChecksum
> Why would the platform calculate the hashes differently?
> Why did older versions of LiveCode calculate it the same?
More information about the use-livecode