HASH        Generate a Message Authentication Code.

<< Click to Display Table of Contents >>

Navigation:  Robo-FTP User's Guide > Script Programming > Script Commands > All Script Commands >

HASH        Generate a Message Authentication Code.

Syntax:

HASH

[ file name ]  [ variable ]  [ /options ]

Arguments:

[ input source ]

A variable or string to specify the file name to read or in memory string data to hash

 

[ variable ]

A variable to store resulting Message Authentication Code; The variable is created if it did not previously exist.

Options:

/hashstring

Treat the input source as raw data rather than as a file to read from.

 

/type=xx

The hash algorithm to be used. This must be one of md5, crc, sha1, sha256, sha384, sha512. The default is md5.

 

/encoding=[hex|base64]

This specifies the output encoding for the generated hash. The default is hex and should not be changed unless you are sure you need base64.

 

 

This script command generates a Message Authentication Code. This code can be used to verify data has not been altered. If the hash for a file changes then the contents of the file changed. Some servers have signature files of the form <filename>.md5 or <filename>.sha1 for <filename> that allow you to verify the copy of the file you have has not been altered.

 

RCVFILE %sitefile

SET hashfile = %sitefile & ".md5"

RCVFILE hashfile

READFILE hashfile realhash

HASH %sitefile genhash

IFNSTRCMPI realhash genhash GOTO file_altered

 

Related command(s): RCVFILE, IFSTRCMP