#### HASH

#### Synopsis

    HELP:   Generation or check of one way hash values of input data
    TYPE:   OBJECT
    SYNTAX: HASH(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 component can be used to generate and check hash values (checksums). This can be useful to verify data integrity of files after transmission or on a storage device.

If you do not specify the output filename, the output of this component is written to the log.

For the output file, all rules and replacements are valid which are described under "FILENAME HANDLING" above. For example:

       OUTPUT=STDERR                          ; is SYSOUT on z/OS
       OUTPUT='~.MYCHECK(HASH1)'              ; PDS on z/OS
       OUTPUT='<SYSUID>.MYCHECK2'             ; PS dataset on z/OS
       OUTPUT='~/mycheck3.txt'                ; Unix path name
       OUTPUT='<HOME>\\hashs\\mycheck4.txt'   ; Windows path name

By using the 'check' overlay, data can be verified against a previously computed hash value that can either be passed directly or from an input file. The result is written to output.

Passing an empty string or filename in the 'check' overlay implies only calculation of the hash without verification.

You can also specify the CCSID parameter. It indicates the CCSID of the check file and the output file. The check file is read once as binary and once as string, with optional character conversion. So, you can generate an ASCII check file on an EBCDIC machine without having to convert this file in a separate step.

The member name supports input output name mapping and can be used to define the file names written to the GNU or BSD formated checksum files. The default of such a member name at read is the original (source) name of the file. At write the target file name is used.

#### Arguments

- `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 - 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 variant`
  - `CRC40 - Cyclic Redundancy Check (40 bit)`
  - `CRC64 - Cyclic Redundancy Check (64 bit)`
- `NUMBER: FORMAT=GNU/BSD/HEX/BIN - Define printout format [GNU]`
  - `GNU - Write output in GNU style`
  - `BSD - Write output in BSD style`
  - `HEX - Write output as hexadecimal string`
  - `BIN - Write output as binary value (only in output file)`
- `STRING: OUTPUT='str'/STDOUT/STDERR - Name of the output file [LOG]`
  - `STDOUT - Write output to stdout`
  - `STDERR - Write output to stderr`
- `STRING: 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]`