aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorDan Brown <dan@weetabix>2021-05-28 15:31:05 +0200
committerRob Landley <rob@landley.net>2021-06-01 14:05:50 -0500
commit71b8c2d9e8bd6526409d440ea4ead410f8d6d8a9 (patch)
treef44941dfb7a2c47576dd491e5de1afa73a6d743c /toys
parent73b1e013f937ef825e4ed033838704b0502abbcb (diff)
downloadtoybox-71b8c2d9e8bd6526409d440ea4ead410f8d6d8a9.tar.gz
add sha256sum command which runs built-in sha1sum routine
Diffstat (limited to 'toys')
-rw-r--r--toys/lsb/md5sum.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/toys/lsb/md5sum.c b/toys/lsb/md5sum.c
index da9b14bc..a7c43c32 100644
--- a/toys/lsb/md5sum.c
+++ b/toys/lsb/md5sum.c
@@ -1,12 +1,13 @@
-/* md5sum.c - Calculate RFC 1321 md5 hash and sha1 hash.
+/* md5sum.c - Calculate hashes md5, sha1, sha256, sha512.
*
- * Copyright 2012 Rob Landley <rob@landley.net>
+ * Copyright 2012, 2021 Rob Landley <rob@landley.net>
*
* See http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/md5sum.html
* and http://www.ietf.org/rfc/rfc1321.txt
+ * and http://www.ietf.org/rfc/rfc4634.txt
*
* They're combined this way to share infrastructure, and because md5sum is
- * and LSB standard command (but sha1sum and newer hashes are a good idea,
+ * a LSB standard command (but sha1sum and newer hashes are a good idea,
* see http://valerieaurora.org/hash.html).
*
* We optionally use openssl (or equivalent) to access assembly optimized
@@ -18,7 +19,7 @@
USE_MD5SUM(NEWTOY(md5sum, "bc(check)s(status)[!bc]", TOYFLAG_USR|TOYFLAG_BIN))
USE_SHA1SUM(NEWTOY(sha1sum, "bc(check)s(status)[!bc]", TOYFLAG_USR|TOYFLAG_BIN))
USE_TOYBOX_LIBCRYPTO(USE_SHA224SUM(OLDTOY(sha224sum, sha1sum, TOYFLAG_USR|TOYFLAG_BIN)))
-USE_TOYBOX_LIBCRYPTO(USE_SHA256SUM(OLDTOY(sha256sum, sha1sum, TOYFLAG_USR|TOYFLAG_BIN)))
+USE_SHA256SUM(NEWTOY(sha256sum, "bc(check)s(status)[!bc]", TOYFLAG_USR|TOYFLAG_BIN))
USE_TOYBOX_LIBCRYPTO(USE_SHA384SUM(OLDTOY(sha384sum, sha1sum, TOYFLAG_USR|TOYFLAG_BIN)))
USE_TOYBOX_LIBCRYPTO(USE_SHA512SUM(OLDTOY(sha512sum, sha1sum, TOYFLAG_USR|TOYFLAG_BIN)))
@@ -58,8 +59,7 @@ config SHA224SUM
config SHA256SUM
bool "sha256sum"
- default y
- depends on TOYBOX_LIBCRYPTO
+ default n
help
See sha1sum
@@ -428,3 +428,8 @@ void sha1sum_main(void)
{
md5sum_main();
}
+
+void sha256sum_main(void)
+{
+ md5sum_main();
+}