HASH

Synopsis

HELP:   Hash calculation/verification
TYPE:   OBJECT
SYNTAX: > flcl HASH(FILE['str'/STREAM/DUMMY...],DIR(),LOG(),ALGO=MD5/RIPEMD128/RIPEMD160/SHA1/SHA224/SHA256/SHA384/SHA512/SHA3-224/SHA3-256/SHA3-384/SHA3-512/CRC8/CRC16/CRC24/CRC32/CRC32C/CRC40/CRC64,CHECK.{},FORMAT=GNU/BSD/HEX/BIN,CUT=num,OUTPUT='str'/STDOUT/STDERR,MEMBER='str',CCSID='str'/DEFAULT/ASCII/EBCDIC/SYSTEM/LOCAL,BLKSIZ=num)

Description

The HASH command calculates or verifies checksums for one or more local or remote input files. Files are read in binary format. Beside hex and binary Checksums in GNU and BSD formats are supported, which are compatible with common tools like 'sha1sum' and 'md5sum' on UNIX systems. This can be useful to verify files transferred between different systems, especially to or from mainframes.

If possible, hardware acceleration is used for hash calculation.

The HASH command prints only minimal log output. For a more verbose output (e.g. statistics), please use the log object (see examples below).

To get syntax information, please use:

   flcl SYNTAX HASH

To get help for the parameters, please use:

   flcl HELP HASH.parameter[.parameter[...]]

To read the manual page for a parameter, please use:

   flcl MANPAGE HASH.parameter[.parameter[...]]
      or
   flcl HELP XCHK.parameter[.parameter[...]] MAN

To generate the user manual for the command, please use:

   flcl GENDOCU HASH=filename

Parameters can be defined via command line (directly or per file) or through properties read from the corresponding property file.

Examples

Calculate the checksum using the default hash algorithm (SHA1) for the file "fileToBeHashed.exe" in default format (GNU) to the default output file (LOG).

   flcl hash file=fileToBeHashed.exe

Calculate the checksum using SHA-512 hash algorithm for the remote file "fileToBeHashed.exe".

   flcl hash file=ssh://<cuser>@server1/fileToBeHashed.exe algo=sha512

Calculate the checksum using SHA-512 hash algorithm for the file "fileToBeHashed.exe" and write the result to the file "outhash.txt".

   flcl hash file=fileToBeHashed.exe algo=sha512 output=outhash.txt

Calculate the checksum using SHA-512 hash algorithm for the file "fileToBeHashed.exe" and write the result to the file "outhash.txt" in IBM-1141 CCSID.

   flcl hash file=fileToBeHashed.exe algo=sha512
      CCSID=IBM-1141 output=outhash1141.txt

Verify the file "fileToBeHashed.exe" using SHA-512 hash algorithm by comparing to the checksum stored in file "outhash.txt".

   flcl hash file=fileToBeHashed.exe algo=sha512 check.file=outhash.txt

Calculate the checksum using SHA-512 hash algorithm for the file "fileToBeHashed.exe". Print log output with the default filter (more output information)

   flcl hash "file=fileToBeHashed.exe algo=sha512 log(message(default))"

If you want to get the hash value of the decompressed content of a file without decompressing it to a temporary file, please take a look at the XCHK command. It is a much more powerful command to analyze input files.

Arguments