This function will get and verify a hash.
1. sac Required: - What to do:
GetMD5 - gets the file's "fingerprint" using MD5
GetSHA1 – gets the file's "fingerprint" using SHA1
VerifyMD5 - compares the hash of the file using MD5
VerifySHA1 - compares the hash of the file using SHA1
2. f/c/e Required: - The file name including path
3. f/c/e This part depends on the option specified in part 1.
RETURN TYPE - Varies
The return value depends on the option set in part 1.
GetMD5 / GetSHA1 - A - Returns the hash value or fingerprint
VerifyMD5 / VerifySHA1 - L - Returns true if the fingerprint matches otherwise returns false
MD5 stands for Message Digest number 5, an algorithm that generates a unique, 128-bit cryptographic message digest value derived from the contents of an input stream. A value such as this is considered to be a reliable fingerprint that can be used to verify the integrity of a file's contents. If as little as a single bit value in the file is modified, the MD5 checksum for the file changes. Forgery of a file in a way that causes MD5 to generate the same result as that for the original file is difficult.
SHA1 - is similar to MD5 but is 160-bit and is considered more secure than MD5.
Using a hash system provides a way to integrity check certain files. You might check the hash of a file in order to verify a copy operation or to verify that a user update has been implemented based on a stored list of known hash codes or as a part of some other verification process.
NOTE: The special alpha constants above (GetMD5 , GetSHA1, VerifyMD5, and VerifySHA1) are defined in COMPILERCONSTANTS.TXT.
Define RetVal Type A Size 50
Define Match Type L
RetVal = HashFile(getMD5,'C:\TEMP\SomeFile.txt')
//does not have to be the same directory
Match = HashFile(VerifyMD5,'C:\TEMP\SomeOtherFileName.txt',RetVal)
msg "The files are the same."
msg "The files are not the same."