×
Menu
Index

MD5 Subroutine

 
Usage:
hash = MD5(file_or_data [, option_flags])
 
Description:
Returns a MD5 hash (or empty string on error) of a file or data provided to the subroutine.  The optional option_flags parameter determines what to hash as well as how to return the hash value.  The option flags are set using bits 0 and 1 as follows:
    Bit 0 Clear = file_or_data contains the name of a file to hash.
               Set  = file_or_data contains the (string or binary) data to hash;
    Bit 1 Clear = return the hash as a string value.
                Set = return the hash as a binary value. 
 
Example:
sub main()
   // note: to set bit 0 we use the value 1 and to set bit 1
   // we use the value 2.  To set both bits we simply add the
   // values together 1+2=3.
 
   printl("The MD5 hash of string ABC is: " # MD5("ABC", 1))
   printl("The MD5 hash of file FILE.EXT is: " # MD5("FILE.EXT"))
 
   binary_data_hash=MD5("string", 3)
   binary_file_hash=MD5("d:\path\file", 2)
end sub