diff --git a/Base/usr/share/man/man1/checksum.md b/Base/usr/share/man/man1/checksum.md index a63dedbd67..2bb7ca02e2 100644 --- a/Base/usr/share/man/man1/checksum.md +++ b/Base/usr/share/man/man1/checksum.md @@ -5,6 +5,7 @@ checksum - helper program for calculating checksums ## Synopsis ```**sh +$ b2sum [options...] $ md5sum [options...] $ sha1sum [options...] $ sha256sum [options...] @@ -14,7 +15,7 @@ $ sha512sum [options...] ## Description This program calculates and print specified checksum of files. It cannot be run directly, only -as `md5sum`, `sha1sum`, `sha256sum` or `sha512sum`. A non-zero exit code is returned if the +as `b2sum`, `md5sum`, `sha1sum`, `sha256sum` or `sha512sum`. A non-zero exit code is returned if the input cannot be read. If the '--check' option is used, a non-zero exit code is also returned if the checksums cannot be verified. diff --git a/Meta/build-root-filesystem.sh b/Meta/build-root-filesystem.sh index a7c20477b3..8eba6b81bd 100755 --- a/Meta/build-root-filesystem.sh +++ b/Meta/build-root-filesystem.sh @@ -200,6 +200,7 @@ ln -sf /bin/env mnt/usr/bin/env echo "done" printf "installing 'checksum' variants... " +ln -sf checksum mnt/bin/b2sum ln -sf checksum mnt/bin/md5sum ln -sf checksum mnt/bin/sha1sum ln -sf checksum mnt/bin/sha256sum diff --git a/Userland/BuggieBox/main.cpp b/Userland/BuggieBox/main.cpp index 52442c9210..8ce7724465 100644 --- a/Userland/BuggieBox/main.cpp +++ b/Userland/BuggieBox/main.cpp @@ -10,6 +10,7 @@ #include #define ENUMERATE_UTILITIES(E, ALIAS) \ + ALIAS(b2sum, checksum) \ E(cat) \ E(checksum) \ E(chmod) \ diff --git a/Userland/Utilities/checksum.cpp b/Userland/Utilities/checksum.cpp index d5386d6c62..3a497ef3a0 100644 --- a/Userland/Utilities/checksum.cpp +++ b/Userland/Utilities/checksum.cpp @@ -19,7 +19,9 @@ ErrorOr serenity_main(Main::Arguments arguments) auto program_name = LexicalPath::basename(arguments.strings[0]); auto hash_kind = Crypto::Hash::HashKind::None; - if (program_name == "md5sum") + if (program_name == "b2sum") + hash_kind = Crypto::Hash::HashKind::BLAKE2b; + else if (program_name == "md5sum") hash_kind = Crypto::Hash::HashKind::MD5; else if (program_name == "sha1sum") hash_kind = Crypto::Hash::HashKind::SHA1; @@ -29,7 +31,7 @@ ErrorOr serenity_main(Main::Arguments arguments) hash_kind = Crypto::Hash::HashKind::SHA512; if (hash_kind == Crypto::Hash::HashKind::None) { - warnln("Error: program must be executed as 'md5sum', 'sha1sum', 'sha256sum' or 'sha512sum'; got '{}'", program_name); + warnln("Error: program must be executed as 'b2sum', 'md5sum', 'sha1sum', 'sha256sum' or 'sha512sum'; got '{}'", program_name); exit(1); }