md5Digest gives different results Mac vs Windows LC 9.5.1

Bill Vlahos bvlahos at mac.com
Sun Apr 19 20:14:59 EDT 2020


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?

Regards,
Bill Vlahos

> On Apr 19, 2020, at 2:15 PM, Brian Milby via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Try this:
> 
> put 0 into x;put binaryDecode("h32",the md5digest of "LiveCode",x);put x
> 
> You will get the same on both platforms.
> 
> On Sun, Apr 19, 2020 at 5:13 PM Bill Vlahos via use-livecode <
> use-livecode at lists.runrev.com> wrote:
> 
>> Well earlier versions of LiveCode gave the same results on Mac and Windows.
>> 
>> Bill
>> 
>>> On Apr 19, 2020, at 1:51 PM, matthias rebbe via use-livecode <
>> use-livecode at lists.runrev.com> wrote:
>>> 
>>> I think this is, because Mac uses Mac Roman and Windows ISO encoding.
>>> 
>>> Or am i wrong?
>>> 
>>> -
>>> Matthias Rebbe
>>> Life Is Too Short For Boring Code
>>> 
>>>> Am 19.04.2020 um 22:34 schrieb Bill Vlahos via use-livecode <
>> use-livecode at lists.runrev.com>:
>>>> 
>>>> Before I report this as a bug, please confirm I’m not doing something
>> stupid.
>>>> 
>>>> LiveCode 9.5.1 Indy
>>>> 
>>>> In the message box put the following:
>>>> put the md5Digest of "LiveCode"
>>>> 
>>>> 
>>>> I get the expected result on Macintosh but a different result on
>> Windows.
>>>> 
>>>> Thank you,
>>>> Bill Vlahos
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> use-livecode at lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>> 
>>> 
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list