I have sha1sum or sha512sum on an average Linux distro.
But where is the sha3sum command that can generateSHA-3 commands?
You can use OpenSSL to do this. Run openssl list -digest-algorithms to get a list of algorithms:
...
SHA3-224
SHA3-256
SHA3-384
SHA3-512
...
As you can see sha3-{224,256,384,512} is supported by OpenSSL 1.1.1 (11 Sep 2018) from Ubuntu 18.10.
You can also run openssl interactively:
OpenSSL> help
...
Message Digest commands (see the `dgst' command for more details)
blake2b512 blake2s256 gost md4
md5 rmd160 sha1 sha224
sha256 sha3-224 sha3-256 sha3-384
sha3-512 sha384 sha512 sha512-224
sha512-256 shake128 shake256 sm3
To checksum a file:
openssl dgst -sha3-512 /bin/echo
SHA3-512(/bin/echo)= c9a3baaa2aa3d667a4ff475d893b3e84eb588fb46adecd0af5f3cdd735be88c62e179f98dc8275955da4ee5ef1dc7968620686c6f7f63f5b80f10e43bc1f00fc
To checksum a string:
printf "foobar" | openssl dgst -sha3-512
You can change the output format with these options:
-c Print out the digest in two digit groups separated by colons-r Output the digest in the "coreutils" format, including newlinesThere are a number of implementations, e.g. Mattias Andrée's sha3sum, or the Perl Digest-SHA3 module. In Debian, install libdigest-sha3-perl; in Fedora, install sha3sum; both of these will provide a sha3sum command based on the Perl module, which behaves in the same way as the binaries you're used to.
For what it's worth, Busybox has had code for it since 2013.
If you have openssl installed you should have the hashalot command which says :
Supported values for HASHTYPE: ripemd160 rmd160 rmd160compat sha256 sha384 sha512
You can also use directly the sha384 command.
A recent enough version of OpenSSL (1.1.1 or later) has full SHA-3 support, openssl help will show:
Message Digest commands (see the `dgst' command for more details)
blake2b512 blake2s256 gost md4
md5 mdc2 rmd160 sha1
sha224 sha256 sha3-224 sha3-256
sha3-384 sha3-512 sha384 sha512
sha512-224 sha512-256 shake128 shake256
sm3
If you're lazy like me and are used to md5sum, sha1sum, sha256sum:
Create the file /usr/local/bin/sha3256sum and make it executable with chmod +x sha3256sum.
#!/bin/bash
rhash --sha3-256 $1
Then you can run:
sha3256sum file