MD5 output (was Encryption)

Wouter wouter.abraham at pi.be
Sat Jun 12 07:57:09 EDT 2004


> Geoff Caplan geoff at advantae.com
> Sat Jun 12 10:21:32 EDT 2004
>
> Hi folks,
>
> I have been attempting to create a checksum digest in Rev for posting
> to a PHP server and checking server-side. The problem I ran into was
> the output from MD5 on Rev is binary, while on PHP it is an ASCII
> string. So of course they don't match.

from http://be.php.net/md5 :

string md5 ( string str [, bool raw_output])

Calculates the MD5 hash of str using the  RSA Data Security, Inc. MD5 
Message-Digest Algorithm, and returns that hash.  The hash is a 
32-character hexadecimal number. If the optional  raw_output is set to 
TRUE, then the md5 digest is instead returned in raw binary format with 
a length of 16.

  Note:  The optional raw_output parameter was added in  PHP 5.0.0 and 
defaults to FALSE


> Does anyone understand what's going on here - I thought MD5 was a
> standard? Is there any way to translate from the binary to the ASCII
> format?

put md5hexDigest(<data>) into <container>

function md5hexDigest x
   get binaryDecode("H*", md5digest(x), tHexDigest)
   return tHexDigest
end md5hexDigest


Greetings,
WA



More information about the use-livecode mailing list