Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
NAME
     rahash2 -- Block-Based Hashing, Encoding, and Encryption Utility

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
     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 stan-
     dard input using '-' and supports comparison against known hashes via  exit
     status codes.

     Commonly  used for forensic analysis, detecting file modifications, and ef-
     ficient processing of large files.

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

     -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

		 rahash2 -R is incompatible with -B (per-block hashing).

     -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.

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>

				  Jul 10, 2025			      RAHASH2(1)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=rahash2&sektion=1&manpath=FreeBSD+Ports+15.1.quarterly>

home | help