Scroll to navigation

RAHASH2(1) General Commands Manual RAHASH2(1)

NAME

rahash2Block-Based Hashing, Encoding, and Encryption Utility

SYNOPSIS

rahash2 [-BehjkLqrvX] [-b S] [-a A] [-c H] [-E A] [-D A] [-s S] [-f O] [-t O] [-i num] [-I iv] [-S seed] [-x hexstr] [file ...]

DESCRIPTION

A utility for computing, verifying, and displaying hash values for each block of a file, with a default block size of 32768 bytes. Reads from standard input using '-' and supports comparison against known hashes via exit status codes.

Commonly used for forensic analysis, detecting file modifications, and efficient processing of large files.

Supports entropy calculation, targeted hashing of file segments or strings, and encoding, decoding, encryption, and decryption using various cryptographic algorithms.

algo
Comma separated list of algorithms (default is 'sha256')
bsize
Specify the size of the block (instead of full file)
Show per-block hash
hash
Compare with this hash
Swap endian (use little endian)
algo
Encrypt. Use -S to set key and -I to set IV
algo
Decrypt. Use -S to set key and -I to set IV
from
Start hashing at given address
num
Repeat hash N iterations (f.ex: 3DES)
iv
Use give initialization vector (IV) (hexa or s:string)
Output in json
New simplified json output (same as -jj)
seed
Use given seed (hexa or s:string) use ^ to prefix (key for -E) (- will slurp the key from stdin, the @ prefix points to a file
Show hash using the openssh's randomkey algorithm
Run in quiet mode (-qq to show only the hash)
List muta plugins (combines with -q, used by -a, -E and -D)
Output radare commands
string
Hash this string instead of files
to
Stop hashing at given address
hexstr
Hash this hexpair string instead of files
Output in hexpairs instead of binary/plain
Show version information

ENVIRONMENT

Rahash2 does not use any environment variables.

EXAMPLES

Calculate the MD5 hash of the 'ls' binary:


$ rahash2 -qqa md5 /bin/ls

Calculate the SHA256 hash of string from stdin:


$ echo -n "Hello, World" | rahash2 -a sha256 -
$ rahash2 -a sha256 -s "Hello, World"

Compare CRC32 of the given file didnt changed:


$ rahash2 -qqa crc32 /bin/ls
63212007
$ rahash2 -a crc32 -c 63212007 /bin/ls
INFO: Computed hash matches the expected one
$ echo $?
0

List all muta (hash, crypto, encoder, charset) plugins:


$ rahash2 -L

Encode the string "Hello World" with base64:


$ rahash2 -E base64 -s "Hello World"

Calculate SHA256 hash of a specific part of a file:


$ rahash2 -qqa sha256 -f 0x1000 -t 0x2000 file_to_hash

Encrypt and decrypt the "hello" string using the ror and rol plugins:


$ rahash2 -S 12333 -E ror -s hello && echo
Cell{
$ rahash2 -S 12333 -E rol -s Cell{ && echo
hello

Encrypting and decrypting using AES-CBC:


$ export AES_KEY="11111111111111111111111111113211"
$ rahash2 -E aes-ecb -S "$AES_KEY" -s "hello world you bastard" > .file
$ cat .file | rahash2 -D aes-ecb -S "$AES_KEY" -s - && echo

Encrypting a file using Blowfish and encode it into a json:


$ rahash2 -E blowfish -S "11111111111111111111111111113211" -j /bin/ls > ls.json

DIAGNOSTICS

The rahash2 utility exits 0 on success, and >0 if an error occurs.

When using the -c flag, an exit status of 0 indicates a match between the expected and computed hashes.

SEE ALSO

radare2(1)

AUTHORS

pancake <pancake@nopcode.org>

July 10, 2025