rz-hash - Man Page

block based hashing utility

Synopsis

rz-hash[-vhBkjLq] [-a algorithm] [-b size] [-c hash] [-D algo] [-E algo] [-s string] [-x hexstr] [-f from] [-t to] [-c hash] [[file] ...]

Description

This program is part of the Rizin project.

rz-hash allows you to calculate, check and show the hash values of each block of a target file. The block size is 32768 bytes by default. It's allowed to hash from stdin using '-' as a target file. You can compare against a known hash and get the result in the exit status.

You can hash big files by hashing each block and later determine what part of it has been modified. Useful for filesystem analysis.

This command can be used to calculate hashes of a certain part of a file or a command line passed string.

This is the command used by the 'ph' command of rizin.

-v

Show version information

-h

Show usage help message

-

Input read from stdin instead of from a file

-a algo

Hash algorithm to use; you can specify multiple ones by appending a comma (example: sha1,md4,md5,sha256)

-B

Output the calculated value for each block

-b size

Set the block size

-c value

Compare calculated value with a given one (hexadecimal)

-e endian

Set the endianness (default: 'big'; accepted: 'big' or 'little')

-D algo

Decrypt the given input; use -S to set the key and -I to set IV (if needed)

-E algo

Encrypt the given input; use -S to set the key and -I to set IV (if needed)

-f from

Start the calculation at the given offset

-t to

Stop the calculation at the given offset

-I iv

Set the initialization vector (IV)

-i times

Repeat the calculation N times

-j

Output the result as a JSON structure

-k

Output the calculated value using openssh's randomkey algorithm

-L

List all algorithms

-q

Set quiet mode (use -qq to get only the calculated value)

-S seed

Set the seed for -a; use '^' to append it before the input. Use '@' prefix to load it from a file and '-' to read it

-K key

Set the HMAC key for -a and the key for -E/-D. Use '@' prefix to load it from a file and '-' to read it from stdin (you can combine them)

-s string

Input read from a zero-terminated string instead of from a file

-x hex

Input read from a hexadecimal value instead of from a file

All the inputs (besides -s/-x/-c) can be hexadecimal or strings if 's:' prefix is specified.

Diagnostics

The rz-hash utility exits 0 on success, and >0 if an error occurs.

When -c is used, exit status 0 indicates a match between the expected and computed hashes

See Also

rizin(1), rz-find(1), rz-hash(1), rz-bin(1), rz-diff(1), rz-asm(1), rz-gg(1), rz-run(1), rz-ax(1),

Authors

pancake <pancake@nopcode.org>

byteninjaa0

Referenced By

rizin(1), rz-asm(1), rz-ax(1), rz-bin(1), rz-diff(1), rz-find(1), rz-gg(1), rz-run(1), rz-sign(1).

January 24, 2024