HELP: Hash calculation/verification
TYPE: OBJECT
SYNTAX: > flcl HASH(FILE['str'/STREAM/DUMMY...],EXCLUDE['str'...],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/CRC64XZ/CRC64ECMA/CRC32POSIX/SHAKE128/SHAKE256,CHECK.{},FORMAT=GNU/BSD/HEX/BIN,CUT=num,OUTPUT='str'/STDOUT/STDERR,MEMBER='str',CCSID='str'/DEFAULT/ASCII/EBCDIC/SYSTEM/LOCAL,BLKSIZ=num)
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.
The complete list of supported algorithms with a short description of each is printed by:
flcl HELP HASH.algo
Beside the cryptographic hashes (SHA-1, SHA-2, SHA-3, MD5, RIPEMD) a set of CRC checksums is available for plain integrity checking. These are not of cryptographic quality and must not be used to protect data against manipulation.
There is no single CRC-64: several parametrisations of the same width are in common use and they produce different values for the same data. Three of them are provided:
For a new setup CRC64XZ is the recommended choice of the three.
For 32 bit there are three as well:
SHAKE128 and SHAKE256 are the extendable-output functions of FIPS 202, the same standard the SHA-3 hashes come from. Unlike a normal digest they have no natural output length: the caller decides how many bytes are produced.
The length is given with the CUT parameter. Without CUT the default is 32 bytes for SHAKE128 and 64 bytes for SHAKE256, which is the length at which each of them reaches its full collision resistance. The largest value that can be requested is 128 bytes.
Because the output is a stream, a shorter value is always the beginning of a longer one. Whether a checksum is produced with CUT=32 directly or taken from the first 32 bytes of a longer one makes no difference.
flcl hash file=data.bin algo=SHAKE256 flcl hash file=data.bin algo=SHAKE256 cut=32 flcl hash file=data.bin algo=SHAKE128 cut=100
These values can be reproduced outside FLAM with 'openssl dgst -shake256 -xoflen 32' and comparable tools.
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.
STRING: FILE['str'/STREAM/DUMMY...] - Name/URL of file to hash [''==origin.ext]
STREAM - Read from stdin or write to stdoutDUMMY - Read EOF or write nothingSTRING: EXCLUDE['str'...] - Exclude files matching the specified wildcard pattern from processing; multi-value [none]NUMBER: ALGO=MD5/RIPEMD128/RIPEMD160/SHA1/SHA224/SHA256/SHA384/SHA512/SHA3-224/SHA3-256/SHA3-384/SHA3-512/CRC8/CRC16/CRC24/CRC32/CRC32C/CRC40/CRC64/CRC64XZ/CRC64ECMA/CRC32POSIX/SHAKE128/SHAKE256 - Hash algorithm [SHA1]
MD5 - Message-Digest Algorithm 5 (128 bit)RIPEMD128 - RACE Integrity Primitives Evaluation Message Digest (128 bit)RIPEMD160 - RACE Integrity Primitives Evaluation Message Digest (160 bit)SHA1 - Secure Hash Algorithm 1 (160 bit)SHA224 - Secure Hash Algorithm 2 (224 bit)SHA256 - Secure Hash Algorithm 2 (256 bit)SHA384 - Secure Hash Algorithm 2 (384 bit)SHA512 - Secure Hash Algorithm 2 (512 bit)SHA3-224 - Secure Hash Algorithm 3 (224 bit)SHA3-256 - Secure Hash Algorithm 3 (256 bit)SHA3-384 - Secure Hash Algorithm 3 (384 bit)SHA3-512 - Secure Hash Algorithm 3 (512 bit)CRC8 - Cyclic Redundancy Check (8 bit)CRC16 - Cyclic Redundancy Check (16 bit)CRC24 - Cyclic Redundancy Check (24 bit)CRC32 - Cyclic Redundancy Check (32 bit)CRC32C - Cyclic Redundancy Check (32 bit) Castagnoli variantCRC40 - Cyclic Redundancy Check (40 bit)CRC64 - Cyclic Redundancy Check (64 bit) JONES variant, kept for compatibility with existing FL5 checksumsCRC64XZ - Cyclic Redundancy Check (64 bit) CRC-64/XZ, the variant used by xz and other toolsCRC64ECMA - Cyclic Redundancy Check (64 bit) CRC-64/ECMA-182 standard formCRC32POSIX - Cyclic Redundancy Check (32 bit) as produced by the POSIX cksum utilitySHAKE128 - SHAKE-128 extendable-output function, 32 byte by default, other lengths via CUTSHAKE256 - SHAKE-256 extendable-output function, 64 byte by default, other lengths via CUTNUMBER: FORMAT=GNU/BSD/HEX/BIN - Define printout format [GNU]
GNU - Write output in GNU styleBSD - Write output in BSD styleHEX - Write output as hexadecimal stringBIN - Write output as binary value (only in output file)STRING: OUTPUT='str'/STDOUT/STDERR - Name of the output file [LOG]
STDOUT - Write output to stdoutSTDERR - Write output to stderrSTRING: MEMBER='str' - Member name in GNU or BSD format [original name at read, target name at write]NUMBER: BLKSIZ=num - Block size for read operations [65536]