RAHASH2(1)

πŸ“¦
version 6.2.2 Β· 4 versions
, in alpine 3.24, arch rolling, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu stonking

πŸ’– RAHASH2(1) πŸ’–

okay bestie, gather round, because this is rahash2 β€” the Block-Based Hashing, Encoding, and Encryption Utility β€” and she is that girl. one command, so many glow-ups. ✨


🌈 SYNOPSIS 🌈

rahash2 [-BehjkLqRrvX] [-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 πŸ¦‹

so basically? this little icon computes, verifies and shows off hash values for each block of a file, and the default block size is 32768 bytes, no cap. you can feed her from standard input using - (yes, just the dash, she gets it), and she also supports comparing against hashes you already know about, using exit status codes as the vibe check. πŸ’…

she's commonly used for forensic analysis, for detecting file modifications, and for chewing through big files efficiently β€” main character energy, honestly.

she also supports entropy calculation, targeted hashing of file segments or strings, and encoding, decoding, encryption and decryption with a whole roster of cryptographic algorithms. it's giving full-stack.

✨ the flags, aka her entire personality ✨

  • -a algo β€” comma separated list of algorithms (default is 'sha256')
  • -b bsize β€” specify the size of the block (instead of full file)
  • -B β€” show per-block hash
  • -c hash β€” compare with this hash
  • -e β€” swap endian (use little endian)
  • -E algo β€” encrypt. use -S to set key and -I to set IV
  • -D algo β€” decrypt. use -S to set key and -I to set IV
  • -f from β€” start hashing at given address
  • -i num β€” repeat hash N iterations (f.ex: 3DES)
  • -I iv β€” use give initialization vector (IV) (hexa or s:string)
  • -j β€” output in json
  • -J β€” new simplified json output (same as -jj)
  • -S 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)
  • -k β€” show hash using the openssh's randomkey algorithm
  • -q β€” run in quiet mode (-qq to show only the hash)
  • -L β€” list muta plugins (combines with -q, used by -a, -E and -D)
  • -r β€” output radare commands (comments), for example:
$ rahash2 -a sha1 -r file | r2 -qni file
  • -R β€” output radare2 sdb commands to store hashes under file.<algo> keys (works with any algorithm name), for example:
$ rahash2 -a sha1 -R file | r2 -qni file
🚨 heads up bestie: rahash2 -R is incompatible with -B (per-block hashing). do not try it. pick a lane.
  • -s string β€” hash this string instead of files
  • -t to β€” stop hashing at given address
  • -x hexstr β€” hash this hexpair string instead of files
  • -X β€” output in hexpairs instead of binary/plain
  • -v β€” show version information

🌸 ENVIRONMENT 🌸

Rahash2 does not use any environment variables. she's low maintenance like that. πŸ’œ zero opinions, zero drama, just vibes.


πŸŽ€ 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. simple as.

when using the -c flag, an exit status of 0 indicates a match between the expected and computed hashes. queen of accountability. πŸ‘‘


πŸ‘€ SEE ALSO πŸ‘€


πŸ’œ AUTHORS πŸ’œ

pancake <pancake@nopcode.org>


and that's the whole page, bestie! this lil bundle of joy was written up on Jul 10, 2025, and it lives in the RAHASH2(1) section of the manual β€” go forth and hash responsibly. mwah. πŸ’‹βœ¨πŸŒˆ

πŸ“¦ where this page comes from