A last question before bed...

david bovill david at openpartnership.net
Sun Sep 25 17:37:30 EDT 2005


Well maybe someone finds this useful too...

How do I reverse the following operation:

      get binaryDecode("H*", someBinaryData, tHexDigest)

With binaryEncode:

      ???

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....


NB thanks to Alex Tweedly I am using the not quite cross platform:

function shell_Md5Hash someFile
   put "md5 -q" && shell_EscapeFile(someFile) into someShell
   return shell(someShell)
end shell_Md5Hash

Instead of revs md5Hash....





More information about the Use-livecode mailing list