A last question before bed...

Alex Tweedly alex at tweedly.net
Sun Sep 25 18:39:00 EDT 2005


david bovill wrote:

>
> I have this function I have been using for a while:
>
> function textFingerPrint someText
>   local tHexDigest
>   put md5digest(someText) into someBinaryData
>   get binaryDecode("H*", someBinaryData, tHexDigest)
>   return tHexDigest
> end textFingerPrint
>
> So I have two questions - why is:
>
>       get binaryDecode("H*", someBinaryData, tHexDigest)
>
> better than using:
>
>     put base64Encode(someBinaryData) into someText
>
> If i am thinking of using the resulting text as a file name? Output  
> can include "+, /, and =" - but that is OK no?
>
> I want to be able to get back to the raw binary data....
>
>
As Mark said, the "/" might give some problems.
The other advantage of using the binaryDecode to hex is that it gives 
you the same hex string as can be produced directly by various md5 
utilities and libraries in other languages; I don't know of any other 
libraries that use base64 encoding of md5 strings.

-- 
Alex Tweedly       http://www.tweedly.net



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.6/111 - Release Date: 23/09/2005




More information about the use-livecode mailing list