×
Menu
Index

SHA256 Subroutine

 
Usage:
hash = SHA256(file_or_data [, option_flags])
 
Description:
Returns a SHA256 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 SHA256 hash of string ABC is: " # SHA256("ABC", 1))
   printl("The SHA256 hash of FILE.EXT is: " # SHA256("FILE.EXT"))
 
   binary_data_hash=SHA256("string", 3)
   binary_file_hash=SHA256("d:\path\file", 2)
end sub