hashrat(1)
π hashrat(1) π
okay bestie, this is the manual for hashrat(1), the hashing tool that supports several hashes and recursivity. It's giving main character energy in your terminal, fr fr. π
πΈ NAME πΈ
hashrat β hashing tool supporting several hashes and recursivity
β¨ SYNOPSIS β¨
hashrat [options] [paths to hash]
hashrat -c [options] [input file of hashes]
π DESCRIPTION π
Hashrat is a hash-generation utility that supports the md5, sha1, sha256, sha512, whirlpool, jh-224, jh256, jh-384 and jh-512 hash functions, and also the HMAC versions of those functions. It can output in traditional format (same as md5sum and shasum and the like) or its own format.
Hashes can be output in octal, decimal, hexadecimal, uppercase hexadecimal and various types of base32 and base64.
Hashrat also supports directory recursion, hashing entire devices, and generating a hash for an entire directory. It has a CGI mode that can be used as a web-page to lookup hashes.
π OPTIONS π
-?,-help,--helpβ Print this help.-version,--versionβ Print program version.-type<type> β Use hash algorithm <type>. Hash types can be chained as a comma-seperated list.-md5β Use md5 hash algorithm. This is the default hash.-sha1β Use sha1 hash algorithm.-sha256β Use sha256 hash algorithm.-sha512β Use sha512 hash algorithm.-whirlβ Use whirlpool hash algorithm.-whirlpoolβ Use whirlpool hash algorithm.-jh224β Use jh-224 hash algorithm.-jh256β Use jh-256 hash algorithm.-jh384β Use jh-384 hash algorithm.-jh512β Use jh-512 hash algorithm.-hmacβ HMAC using specified hash algorithm.-totp<secret> β TOTP code from supplied secret (defaults to google authenticator compatible code).-totp<url> β TOTP code from supplied otpauth url, the url is distinguished from a secret using the leading'oftpauth:'component.-digits<n> β Produce TOTP code with <n> digits.-period<n> β Produce TOTP code with period/lifetime of <n> seconds.-8β Encode with octal instead of hex.-10β Encode with decimal instead of hex.-H,-HEXβ Encode with UPPERCASE hexadecimal.-32,-base32β encode with base32.-c32β encode with Crockfords base32.-w32β encode with word-safe base32.-z32β encode with zbase32.-64,-base64β encode with base64.-i64,-i64β Encode with base64, with rearranged characters.-p64,-p64β Encode with base64 with a-z,A-Z and _-, for best compatibility with 'allowed characters' in websites.-x64,-x64β Encode with XXencode style base64.-u64,-u64β Encode with UUencode style base64.-g64,-g64β Encode with GEDCOM style base64.-a85,-a85β Encode with ASCII85.-z85,-z85β Encode with ZEROMQ variant of ASCII85.-t,-tradβ Output hashes in traditional md5sum, shaXsum format.-tag,--tag,-bsdβ Output hashes in bsdsum format.-rβ Recurse into directories when hashing files.-hidβ Show hidden (starting with .) files-hiddenβ Show hidden (starting with .) files-f<listfile> β Hash files listed in <listfile>.-i<pattern> β Only hash items matching a comma-seperated list of shell patterns. Please be aware that-idoes not yet work on directories, only files.-x<pattern> β Exclude items matching a comma-seperated list of shell patterns. Works on both directories and files.-X<path> β Exclude items listed in file <path>. Items in the file can be wildcards.-name<pattern> β Only hash items matching a comma-seperated list of shell patterns (-nameas in the 'find' command).-mtime<days> β Only hash items <days> old. Has the same format as the find command, e.g.-10is younger than ten days,+10is older than ten, and10is ten days old.-mmin<mins> β Only hash items <min> minutes old. Has the same format as the find command, e.g.-10is younger than ten mins,+10is older than ten, and10is ten mins old.-myear<years> β Only hash items <years> old. Has the same format as the find command, e.g.-10is younger than ten years,+10is older than ten, and10is ten years old.-execβ In CHECK or MATCH mode only examine executable files.-dupsβ Search for duplicate files.-renameβ Rename files to include hash at the end of their filename. Files will have format <name>-<hash>.<extn>.-n<length> β Truncate hashes to <length> bytes.-cβ CHECK hashes against list from file (or stdin).-cfβ CHECK hashes but only show failures.-C<dir> β CHECK files under dir recursively against a list from file (or stdin). This can detect 'new' files-Cf<dir> β CHECK files under dir recursively against a list from file (or stdin). This can detect 'new' files. Only show failures.-mβ MATCH files from a list read from stdin.-lmβ Read hashes from stdin, upload them to a memcached server (requires the-memcachedoption).-memcached<server>,-mcd<server> β Specify memcached server. This option overrides reading list from stdin if used with-m,-cor-cf.-h<script>,-hook<script> β Script to run when a file fails CHECK mode, or is found in MATCH mode. Script is passed the filename as an argument. In 'find duplicates' mode a second file name (the duplicate) will be passed as the second argument.-colorβ Use ANSI color codes on output when checking hashes.-S,-strictβ Strict mode: when checking, check file mtime, owner, group, and inode as well as its hash.-dβ Dereference (follow) symlinks.-fsβ Stay one filesystem.-dir,-dirmodeβ DirMode: read all files in directory and create one hash for them (implies-r).-devmodeβ DevMode: read from a file EVEN IF IT'S A DEVNODE.-linesβ Read lines from stdin and hash each line independently.-rl,-rawlinesβ Read lines from stdin and hash each line independently, INCLUDING any trailing whitespace. This is compatible with'echo text | md5sum'.-cgiβ Run in HTTP CGI mode.-xdialogβ Run in 'xdialog' (zenity, yad or qarama) mode.-dialog-typesβ Specify a list of dialog commands and use the first found on the system. Default is'yad,zenity,qarma'.-iprefix<prefix> β String to prefix all input before hashing-oprefix<prefix> β Prefix to add to the front of output hashes-netβ Treat 'file' arguments as either ssh or http URLs, and pull files over the network and then hash them (allows hashing of files on remote machines). URLs are in the formatssh://[username]:[password]@[host]:[port]orhttp://[username]:[password]@[host]:[port].-idfile<path> β Path to a ssh private key file to use to authenticate INSTEAD OF A PASSWORD when pulling files via ssh.-xattrβ Use eXtended file ATTRibutes. In hash mode, store hashes in the file attributes. In check mode compare against hashes stored in file attributes.-txattrβ Use TRUSTED eXtended file ATTRibutes. In hash mode, store hashes in trusted file attributes. The trusted attributes can only be read and written by root. Under FreeBSD this means 'SYSTEM' attributes.-cacheβ Use hashes stored in user xattr if they're younger than the mtime of the file. This speeds up outputting hashes. When storing xattr hashes, do not update files that already have the correct hash.-u<types> β Update. In checking mode, update hashes for the files as you go. The <types> is a comma-separated list of things to update, which can bexattrmemcachedor a file name. This will update these targets with the hash that was found at the time of checking.-hide-inputβ When reading data from stdin in linemode, set the terminal to not echo characters, thus hiding typed input.-xselβ Update X11 clipboard and primary selections to the current hash. This works using Xterm command sequences. The xterm resource'allowWindowOps'must be set to'true'for this to work.-star-inputβ When reading data from stdin in linemode replace characters with stars.
π¦ NOTES π¦
Hashrat can also detect if it's being run under any of the following names (e.g., via symlinks):
md5sumβ Run with'-trad -md5'.shasumβ Run with'-trad -sha1'.sha1sumβ Run with'-trad -sha1'.sha256sumβ Run with'-trad -sha256'.sha512sumβ Run with'-trad -sha512'.jh224sumβ Run with'-trad -jh224'.jh256sumβ Run with'-trad -jh256'.jh384sumβ Run with'-trad -jh384'.jh512sumβ Run with'-trad -jh512'.whirlpoolsumβ Run with'-trad -whirl'.hashrat.cgiβ Run in web-enabled 'cgi mode'.
β¨ EXAMPLES β¨
okay bestie, this is the fun part, these are all real commands you can literally type right now π
hashrat
Generate a md5 hash of data read from stdin (default hash type is md5, in case you forgot already π).
hashrat -jh256
Generate a jh-256 hash of data read from stdin.
hashrat -sha256 -64
Generate a sha-256 hash of data read from stdin, output with base64 encoding.
hashrat -sha256 -64 -lines
Read lines from stdin, and generate a sha-256 with base64 encoding FOR EVERY LINE. This strips any whitespace from the end of the line (including \r and/or \n line terminators).
hashrat -md5 -trad -rawlines
Read lines from stdin, and generate a md5 hash in traditional format for every line INCLUDING TRAILING WHITESPACE. This is compatible with echo text | md5sum, where text is one line, as echo adds a newline to the end of the text it outputs. fr fr, the trailing whitespace matters here.
hashrat -type sha256,whirl,md5 -64
Generate a sha-256 hash of data read from stdin, then hash the result with whirlpool, then with md5. Hash inception, no cap π
hashrat *
Generate a list of hashes for files in the current directory (default hash type is md5).
hashrat -r -sha1 * > hashes.sha1
Generate a list of hashes for files in the current directory, AND ALL SUBDIRECTORIES, using sha1 hashing.
cat hashes.sha1 | hashrat -c
Check hashes listed in hashes.sha1.
cat hashes.sha1 | hashrat -c -strict
Check hashes listed in hashes.sha1. If hashes are NOT in traditional format than the -strict flag will cause hashrat to check the files uid, gid, size, mtime and inode and print a failure message if any of those don't match.
cat hashes.sha1 | hashrat -cf
Check hashes listed in hashes.sha1 but only output failures. Quiet queen energy π
cat APT1.md5 | hashrat -m -r /
Read a list of hashes from stdin and search recursively for files matching them.
cat APT1.md5 | hashrat -lm -memcached 127.0.0.1
Read a list of hashes from stdin, and register them in a memcached server.
hashrat -m -memcached 127.0.0.1 -r /
Search recursively for files whose hashes are stored in a memcached server.
hashrat -devmode -whirlpool -64 /dev/sda1
Generate a whirlpool hash of the entire device /dev/sda1. Output result in base 64.
hashrat -sha1 -net ssh:user:password@myhost/bin/*
Generate sha1 hashes of files in /bin/* on the remote machine 'myhost'.
hashrat -whirlpool -net http://myhost.com/webpage.html
Generate whirlpool hash for the listed URL. Note, many webpages have dynamic content that changes every time, so this will only return the same hash over and over if the page is static and doesn't change. So like, don't be shocked when the hash changes, it's giving the page changed π
hashrat -dups -r /home -u xattr
Search for duplicate files under /home. Update hashes stored in filesystem attributes as you go.
π USES FOR HASHRAT π
bestie this is the good stuff, the why behind the what. sit down, hydrate, let's go π«Ά
1) Strong Passwords
Hashrat can be used to generate strong passwords for websites. So, you don't have to remember the strong password, if it be always regenerate with hashrat. You need to remember a handful of moderately decent passwords, i.e., things that I can't find by grepping in the '10,000 most popular passwords' list[1], and an additional personal pin. Now, you need to combine the website name, one of passwords, and the personal pin, into a string and feed them into hashrat:
$ echo "facebook.com password 1234" | hashrat -sha1 -64
Obviously, a good password isn't 'password' and a good pin isn't '1234', but you get the idea. This gives a 28-character string that should take "8.02 trillion centuries" to crack with a "massive cracking array", according to Steve Gibson's Password haystacks utility[2]. This is what I then use as my password. Unfortunately some websites won't take a 28-character password, and for these you can truncate to the appropriate length (using the -n flag), but the results are still stronger than anything you could remember, and nothing needs storing on disk (as with password managers). iconic behaviour tbh π
β οΈ There are some dangers to using the 'echo' method shown above if you are on a shared machine, or if someone gets hold of your computer/harddrive. On a shared machine someone could typeps axto see all commands running, and if they time it right, they might see your command-line with your password in it. Another danger lies in using a shell (like bash) that will record your typed commands so you can recall them later. Bash stores this information on disk in the file.bash_history, so if you use the 'echo' method shown above your password will be saved on disk. π
To combat this hashrat has line mode:
$ hashrat -sha1 -64 -lines
This reads lines from stdin, so type into hashrat and then press ENTER, and you'll be given the hash of the line you typed. By this method your password is neither visible in ps ax, nor is ever stored on disk. we love a privacy queen β¨
A -lines will produce a different hash to the 'echo' method listed above, because it strips any trailing whitespace off the lines read. If you want strict compatibility with 'echo' (by default echo adds a newline to the end of the text to output) then use rawlines mode:
$ hashrat -sha1 -64 -rawlines
Finally, you can prevent shoulder-surfers seeing you type your password by using the -hide-input or -star-input options to hide what you type. π΅οΈββοΈ
[1] https://github.com/discourse/discourse/blob/master/lib/common_passwords/10k-common-passwords.txt
[2] https://www.grc.com/haystack.htm
2) Watching for file changes
Like md5sum/shasum etc, hashrat can be used to detect changes in files that might indicate malicious activity. For instance, in order to get early warning of malware like cryptolocker (that encrypts files on a users disk, or on network shares, and then demands a ransom for file recovery) you can scatter about the disk a number of Canary files that should not change. You need record their hashes and regularly check them. If they change, you will know something is going on. π€ canary files are the moment
Hashes generated by hashrat can be output to a file, or stored in extended file attributes, or in a memcached server.
$ hashrat -sha256 -r . > /tmp/files.sha256
$ hashrat -sha256 -r . -xattr
$ hashrat -sha256 -r . -memcached
Similarly these can then be used to check files later:
$ cat /tmp/files.sha256 | hashrat -c -sha256
$ hashrat -C . -sha256 -xattr
$ hashrat -C /tmp -sha256 -memcached
Note that -c checks only check the files in the supplied list. The -C flag instead checks all files in a directory (supplied on command line) and expects to find those in the list. This means that -C can find new files that aren't in the list, whereas -c can't.
There is a slight difference between xattr/memcached checks and checks where a list is read from stdin. Currently when reading from stdin hashrat will ONLY check the files in the list. However, in -xattr and -memcached mode, it will check all files, outputting and error for those where no stored hash can be found. This is likely to change in the a future release, with the stdin method being brought into line with the others. so like, don't be surprised, it's a known vibe π
3) Finding files that match hashes
Using the -m flag hashrat can be told to read a range of hashes from stdin, and then search for files matching those hashes. For Example:
$ cat APT1-AppendixE-MD5s.txt | hashrat -r -m /usr
The last command will search recursively under /usr for files with hashes matching those in APT1-AppendixE-MD5s.txt. The input on stdin must begin with a hash, anything written after the hash will be treated as a comment to be displayed if a file matching the hash is found. comments as a lil treat π
Hashtypes other than md5 can be used thusly:
$ cat sha1-list.lst | hashrat -r -sha1 -m /usr
Hashes can also be loaded into a memcached server, so that the same file list can be checked on a number of machines, without needing to store the hashlist on those machines. First you need load the hashes:
$ cat APT1-AppendixE-MD5s.txt | hashrat -lm -memcached 192.168.1.5
The last line loads the hashes to a memcached server at 192.168.1.5. You can then search against the memcached server by:
$ hashrat -r -m -memcached 192.168.1.5 /usr
4) Find duplicate files
Using the -dups flag (usually in combination with the -r recursive flag) hashrat can be set to search for duplicate files and output any found to stdout. twins!! π―ββοΈ
5) As an 'ls'
Hashrat outputs a file's name, type, mode, mtime, uid, gid and size, along with a hash. This allows it to be used as a kind of 'ls' by ftp style programs, listing all the details of a file, but with the added feature of a hash. it's giving ls but with β¨rangeβ¨
6) Hashing files on remote machines
If run with the '-net' option, hashrat will treat paths starting with 'http://' or 'ssh://' differently, connecting to the target machine and pulling files off it (hashrat assumes there is no hashing program on the remote machine, and that it must therefore download the files to hash them). For ssh paths wildcars are supported:
hashrat -net ssh://username:password@server/usr/bin/*
7) As a TOTP authenticator
Hashrat can be used as a TOTP authenticator, and defaults to google-authenticator compatible codes.
hashrat -totp 3EK4LIB2553CUPA7DBXJMMKDCYTEA2IZA
π HOOKSCRIPTS π
Hookscripts, defined using the -h or -hook command-line options, are scripts that are run for each hashed item. -h and -hook options take an argument that is the path to the script. Hookscripts behave differently in different modes:
Check Hashes mode.
The hookscript is called if a file doesn't match its expected hash, or is not listed in the expected hashes. It is passed the path of the file.
Locate files mode
The hookscript is called if a file matches the hash to locate. It is passed the path of the file.
Find duplicates mode
The hookscript is called if a file is a duplicate of another file. It is passed the paths of both files.
π CGI MODE π
okay so bestie, picture this: you run hashrat with the -cgi flag, or you run it under the name hashrat.cgi β and you can make that happen either by renaming the actual hashrat executable or by pointing a symbolic link at it β and boom, it outputs a webpage where people can look up hashes over the web. why do we care? because it means you can look up your strong passwords even when you don't have a local copy of hashrat with you. main character energy fr fr. π
CGI Mode gets configured with an options file, and you hand over that file's path in the url, like this:
hashrat.cgi?OptionsFile=/etc/hashrat.options
If an options file is used, CGI mode takes the options in that file as its defaults. the file contains all of this:
HashType<type> β the type of hash to generateEncoding<type> β the type of encoding to use for the outputted hashLine Ending<type> β the line ending to append to the input text. this exists for compatibility with command-line usage alongside-rawlines. your options here are"none","lf","crlf"or"cr", which mean"none","newline","carriage-return newline"and"carriage-return"respectivelyOutputLength<len> β crop the output hash to length lenSegmentLength<len> β break the output up into segments of length lenSegmentChar<char> β separate those output segments with the character charNoOptionsβ don't offer the user the options so they can change them. just show an entry box to enter text. simple, clean, no notes πHideTextβ hide the inputted text (this overrides any other config)ShowTextβ show the inputted text (this also overrides any other config)
Example, bestie, straight up:
HashType=sha256
Encoding=base64
LineEnding=none
OutputLength=12
SegmentLength=4
SegmentChar=+
NoOptions=Y
π TOTP MODE
Hashrat can be your TOTP (Time-based One Time Password) authenticator, and out of the box it defaults to google-authenticator compatible codes. the simplest possible use case is literally just:
hashrat -totp <secret>
and if you want to change things up? you can change the hash, the period/lifetime and the number of digits in the TOTP code, like so:
hashrat -totp 3EK4LIB2553CUPA7DB -sha256 -period 90 -digits 8
π CLIPBOARD OUTPUT
Hashes produced in standard-in input mode, plus TOTP codes, can be pushed straight to the system clipboard using the -clip option. how does it find a clipboard? it first tries to find a command that can set the clipboard, searching for one of 'xsel', 'xclip' or 'pbcopy'. and if it can't find any of those, it falls back to using xterm's built in clipboard setting method. resourceful queen π
Alternatively, the -xsel option only attempts to use the xterm clipboard setting method. no searching, just xterm, periodt.
And the default list of clipboard commands can be overridden using the -clipcmd option. π«Ά
π³ QRCODE OUTPUT
Hashes produced in standard-in input mode, and TOTP codes, can be displayed as qrcodes using the -qr or -qrcode options. heads up though: these options require the "qrencode" utility to be installed, and an image viewer that can actually display the qrcode image.
By default hashrat searches for these image viewers:
imlib2_view,fim,feh,display,xv,phototonic,qimageviewer,pix,sxiv,qimgv,qview,nomacs,geeqie,ristretto,mirage,fotowall,links -g
And the default list of image viewers can be overridden using the -viewcmd option. π
β¨ RENAME FILES
The -rename option lets you rename files so they include a hash in their filename. the filename format is <name>-<hash>.<extn>. for example:
hashrat -p64 -md5 -rename main.c
Will rename main.c to main-gAmHI2oarRmpiXkE7MVK90.c, where gAmHI2oarRmpiXkE7MVK90 is its MD5 hash encoded with the p64 base-64 encoding scheme. (yes the original really does write "it`s" with a backtick, we're not touching it, that's just how it is π)
okay so this part matters: the standard-64encoding scheme uses the/character, which is not allowed in a filename and results in renames failing. so you should be using the-p64or-r64encoding schemes instead. don't say we didn't warn you. π
And using the -r flag, you can rename entire directories of files in this manner:
hashrat -p64 -md5 -rename -r myfiles
πΈ EXTENDED FILESYSTEM ATTRIBUTES
Hashrat can use extended filesystem attributes where those are supported. what does that get you? it lets a hash be stored in the filesystem metadata of the target file. then you can use that for checking hashes, or for caching hashes so you get faster output during hashing runs. there are two types of filesystem attribute: trusted attributes, which can only be set and read by root, and user attributes, which can be set and read by any user that has the appropriate permissions for the file.
You store hashes against files by using the -xattr option to set user attributes:
$ hashrat -sha256 -r . -xattr
And you use the -txattr flag to set trusted attributes (and you must be root to set trusted attributes):
# hashrat -sha256 -r . -txattr
When checking, either flag can be used, but hashrat will always use trusted attributes when it's running as root, if those are available, otherwise it falls back to user attributes.
$ hashrat -c -sha256 -r . -xattr
The -cache option allows using stored hashes rather than regenerating hashes. note that it only considers hashes stored in user attributes at current.
$ hashrat -r . -cache
This makes getting a report of hashes considerably faster, but it runs the risk that the hashes may not be accurate. Hashrat will only output a hash stored in file attributes if the storage time of the hash is younger than the modify time (mtime) of the file β however, that means an attacker could change the modify time of the file to hide changes they've made. so yeah:
this feature should not be used for security checking purposes. (but it should be safe for uses like finding files that have changed and need to be backed up, for instance. so like, backup vibes only. π¦)
π AUTHOR
The hashrat was written by Colum Paget <colums.projects@gmail.com>. π
This manual page was written by Joao Eriberto Mota Filho <eriberto@debian.org> for the Debian project (but may be used by others). π«Ά
and that's the whole page bestie, we did it!! π this was hashrat(1) β HASHRAT 1.23, dated Dec 2024. slay, go hash something iconic, ily, bye π
β¨πΈ
π¦ where this page comes from
- debian trixie: hashrat 1.25+ds-1 Β· GPL-3.0-only
- nixos 26.05: hashrat 1.25
- nixpkgs unstable: hashrat 1.25
- ubuntu questing: hashrat 1.25+ds-1
- ubuntu resolute: hashrat 1.25+ds-2 Β· GPL-3.0-only
- ubuntu stonking: hashrat 1.25+ds-2build1 Β· GPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms