diff options
author | Allan Jude <allanjude@FreeBSD.org> | 2016-05-29 01:15:36 +0000 |
---|---|---|
committer | Allan Jude <allanjude@FreeBSD.org> | 2016-05-29 01:15:36 +0000 |
commit | b468a9ff1d3a70c6d14cf2b49574cbbcc60ff997 (patch) | |
tree | 59f55ee6a0d920a0aada43db03458cad3bea0e3f /sbin/md5 | |
parent | 31dd9effd91ca134be7bcaabee571765c265a671 (diff) | |
parent | 92f76dc624c277a7c731733a4e51997c0e9ad981 (diff) | |
download | src-test2-b468a9ff1d3a70c6d14cf2b49574cbbcc60ff997.tar.gz src-test2-b468a9ff1d3a70c6d14cf2b49574cbbcc60ff997.zip |
Notes
Diffstat (limited to 'sbin/md5')
-rw-r--r-- | sbin/md5/Makefile | 10 | ||||
-rw-r--r-- | sbin/md5/md5.c | 59 |
2 files changed, 62 insertions, 7 deletions
diff --git a/sbin/md5/Makefile b/sbin/md5/Makefile index 99402158e4a5..cb643ea18bef 100644 --- a/sbin/md5/Makefile +++ b/sbin/md5/Makefile @@ -9,14 +9,20 @@ LINKS= ${BINDIR}/md5 ${BINDIR}/rmd160 \ ${BINDIR}/md5 ${BINDIR}/sha256 \ ${BINDIR}/md5 ${BINDIR}/sha384 \ ${BINDIR}/md5 ${BINDIR}/sha512 \ - ${BINDIR}/md5 ${BINDIR}/sha512t256 + ${BINDIR}/md5 ${BINDIR}/sha512t256 \ + ${BINDIR}/md5 ${BINDIR}/skein256 \ + ${BINDIR}/md5 ${BINDIR}/skein512 \ + ${BINDIR}/md5 ${BINDIR}/skein1024 MLINKS= md5.1 rmd160.1 \ md5.1 sha1.1 \ md5.1 sha256.1 \ md5.1 sha384.1 \ md5.1 sha512.1 \ - md5.1 sha512t256.1 + md5.1 sha512t256.1 \ + md5.1 skein256.1 \ + md5.1 skein512.1 \ + md5.1 skein1024.1 LIBADD= md diff --git a/sbin/md5/md5.c b/sbin/md5/md5.c index 4f9792b2926b..ddf3a3cca768 100644 --- a/sbin/md5/md5.c +++ b/sbin/md5/md5.c @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include <sha384.h> #include <sha512.h> #include <sha512t.h> +#include <skein.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -61,6 +62,9 @@ extern const char *SHA384_TestOutput[MDTESTCOUNT]; extern const char *SHA512_TestOutput[MDTESTCOUNT]; extern const char *SHA512t256_TestOutput[MDTESTCOUNT]; extern const char *RIPEMD160_TestOutput[MDTESTCOUNT]; +extern const char *SKEIN256_TestOutput[MDTESTCOUNT]; +extern const char *SKEIN512_TestOutput[MDTESTCOUNT]; +extern const char *SKEIN1024_TestOutput[MDTESTCOUNT]; typedef struct Algorithm_t { const char *progname; @@ -87,12 +91,15 @@ typedef union { SHA384_CTX sha384; SHA512_CTX sha512; RIPEMD160_CTX ripemd160; + SKEIN256_CTX skein256; + SKEIN512_CTX skein512; + SKEIN1024_CTX skein1024; } DIGEST_CTX; /* max(MD5_DIGEST_LENGTH, SHA_DIGEST_LENGTH, SHA256_DIGEST_LENGTH, SHA512_DIGEST_LENGTH, - RIPEMD160_DIGEST_LENGTH)*2+1 */ -#define HEX_DIGEST_LENGTH 129 + RIPEMD160_DIGEST_LENGTH, SKEIN1024_DIGEST_LENGTH)*2+1 */ +#define HEX_DIGEST_LENGTH 257 /* algorithm function table */ @@ -117,7 +124,16 @@ static const struct Algorithm_t Algorithm[] = { &SHA512_256_Data, &SHA512_256_File }, { "rmd160", "RMD160", &RIPEMD160_TestOutput, (DIGEST_Init*)&RIPEMD160_Init, (DIGEST_Update*)&RIPEMD160_Update, - (DIGEST_End*)&RIPEMD160_End, &RIPEMD160_Data, &RIPEMD160_File } + (DIGEST_End*)&RIPEMD160_End, &RIPEMD160_Data, &RIPEMD160_File }, + { "skein256", "Skein256", &SKEIN256_TestOutput, + (DIGEST_Init*)&SKEIN256_Init, (DIGEST_Update*)&SKEIN256_Update, + (DIGEST_End*)&SKEIN256_End, &SKEIN256_Data, &SKEIN256_File }, + { "skein512", "Skein512", &SKEIN512_TestOutput, + (DIGEST_Init*)&SKEIN512_Init, (DIGEST_Update*)&SKEIN512_Update, + (DIGEST_End*)&SKEIN512_End, &SKEIN512_Data, &SKEIN512_File }, + { "skein1024", "Skein1024", &SKEIN1024_TestOutput, + (DIGEST_Init*)&SKEIN1024_Init, (DIGEST_Update*)&SKEIN1024_Update, + (DIGEST_End*)&SKEIN1024_End, &SKEIN1024_Data, &SKEIN1024_File } }; static void @@ -286,8 +302,8 @@ MDTimeTrial(const Algorithm_t *alg) printf(" done\n"); printf("Digest = %s", p); printf("\nTime = %f seconds\n", seconds); - printf("Speed = %f bytes/second\n", - (float) TEST_BLOCK_LEN * (float) TEST_BLOCK_COUNT / seconds); + printf("Speed = %f MiB/second\n", (float) TEST_BLOCK_LEN * + (float) TEST_BLOCK_COUNT / seconds / (1 << 20)); } /* * Digests a reference suite of strings and prints the results. @@ -382,6 +398,39 @@ const char *RIPEMD160_TestOutput[MDTESTCOUNT] = { "5feb69c6bf7c29d95715ad55f57d8ac5b2b7dd32" }; +const char *SKEIN256_TestOutput[MDTESTCOUNT] = { + "c8877087da56e072870daa843f176e9453115929094c3a40c463a196c29bf7ba", + "7fba44ff1a31d71a0c1f82e6e82fb5e9ac6c92a39c9185b9951fed82d82fe635", + "258bdec343b9fde1639221a5ae0144a96e552e5288753c5fec76c05fc2fc1870", + "4d2ce0062b5eb3a4db95bc1117dd8aa014f6cd50fdc8e64f31f7d41f9231e488", + "46d8440685461b00e3ddb891b2ecc6855287d2bd8834a95fb1c1708b00ea5e82", + "7c5eb606389556b33d34eb2536459528dc0af97adbcd0ce273aeb650f598d4b2", + "4def7a7e5464a140ae9c3a80279fbebce4bd00f9faad819ab7e001512f67a10d", + "d9c017dbe355f318d036469eb9b5fbe129fc2b5786a9dc6746a516eab6fe0126" +}; + +const char *SKEIN512_TestOutput[MDTESTCOUNT] = { + "bc5b4c50925519c290cc634277ae3d6257212395cba733bbad37a4af0fa06af41fca7903d06564fea7a2d3730dbdb80c1f85562dfcc070334ea4d1d9e72cba7a", + "b1cd8d33f61b3737adfd59bb13ad82f4a9548e92f22956a8976cca3fdb7fee4fe91698146c4197cec85d38b83c5d93bdba92c01fd9a53870d0c7f967bc62bdce", + "8f5dd9ec798152668e35129496b029a960c9a9b88662f7f9482f110b31f9f93893ecfb25c009baad9e46737197d5630379816a886aa05526d3a70df272d96e75", + "15b73c158ffb875fed4d72801ded0794c720b121c0c78edf45f900937e6933d9e21a3a984206933d504b5dbb2368000411477ee1b204c986068df77886542fcc", + "23793ad900ef12f9165c8080da6fdfd2c8354a2929b8aadf83aa82a3c6470342f57cf8c035ec0d97429b626c4d94f28632c8f5134fd367dca5cf293d2ec13f8c", + "0c6bed927e022f5ddcf81877d42e5f75798a9f8fd3ede3d83baac0a2f364b082e036c11af35fe478745459dd8f5c0b73efe3c56ba5bb2009208d5a29cc6e469c", + "2ca9fcffb3456f297d1b5f407014ecb856f0baac8eb540f534b1f187196f21e88f31103128c2f03fcc9857d7a58eb66f9525e2302d88833ee069295537a434ce", + "1131f2aaa0e97126c9314f9f968cc827259bbfabced2943bb8c9274448998fb3b78738b4580dd500c76105fd3c03e465e1414f2c29664286b1f79d3e51128125" +}; + +const char *SKEIN1024_TestOutput[MDTESTCOUNT] = { + "0fff9563bb3279289227ac77d319b6fff8d7e9f09da1247b72a0a265cd6d2a62645ad547ed8193db48cff847c06494a03f55666d3b47eb4c20456c9373c86297d630d5578ebd34cb40991578f9f52b18003efa35d3da6553ff35db91b81ab890bec1b189b7f52cb2a783ebb7d823d725b0b4a71f6824e88f68f982eefc6d19c6", + "6ab4c4ba9814a3d976ec8bffa7fcc638ceba0544a97b3c98411323ffd2dc936315d13dc93c13c4e88cda6f5bac6f2558b2d8694d3b6143e40d644ae43ca940685cb37f809d3d0550c56cba8036dee729a4f8fb960732e59e64d57f7f7710f8670963cdcdc95b41daab4855fcf8b6762a64b173ee61343a2c7689af1d293eba97", + "35a599a0f91abcdb4cb73c19b8cb8d947742d82c309137a7caed29e8e0a2ca7a9ff9a90c34c1908cc7e7fd99bb15032fb86e76df21b72628399b5f7c3cc209d7bb31c99cd4e19465622a049afbb87c03b5ce3888d17e6e667279ec0aa9b3e2712624c01b5f5bbe1a564220bdcf6990af0c2539019f313fdd7406cca3892a1f1f", + "ea891f5268acd0fac97467fc1aa89d1ce8681a9992a42540e53babee861483110c2d16f49e73bac27653ff173003e40cfb08516cd34262e6af95a5d8645c9c1abb3e813604d508b8511b30f9a5c1b352aa0791c7d2f27b2706dccea54bc7de6555b5202351751c3299f97c09cf89c40f67187e2521c0fad82b30edbb224f0458", + "f23d95c2a25fbcd0e797cd058fec39d3c52d2b5afd7a9af1df934e63257d1d3dcf3246e7329c0f1104c1e51e3d22e300507b0c3b9f985bb1f645ef49835080536becf83788e17fed09c9982ba65c3cb7ffe6a5f745b911c506962adf226e435c42f6f6bc08d288f9c810e807e3216ef444f3db22744441deefa4900982a1371f", + "cf3889e8a8d11bfd3938055d7d061437962bc5eac8ae83b1b71c94be201b8cf657fdbfc38674997a008c0c903f56a23feb3ae30e012377f1cfa080a9ca7fe8b96138662653fb3335c7d06595bf8baf65e215307532094cfdfa056bd8052ab792a3944a2adaa47b30335b8badb8fe9eb94fe329cdca04e58bbc530f0af709f469", + "cf21a613620e6c119eca31fdfaad449a8e02f95ca256c21d2a105f8e4157048f9fe1e897893ea18b64e0e37cb07d5ac947f27ba544caf7cbc1ad094e675aed77a366270f7eb7f46543bccfa61c526fd628408058ed00ed566ac35a9761d002e629c4fb0d430b2f4ad016fcc49c44d2981c4002da0eecc42144160e2eaea4855a", + "e6799b78db54085a2be7ff4c8007f147fa88d326abab30be0560b953396d8802feee9a15419b48a467574e9283be15685ca8a079ee52b27166b64dd70b124b1d4e4f6aca37224c3f2685e67e67baef9f94b905698adc794a09672aba977a61b20966912acdb08c21a2c37001785355dc884751a21f848ab36e590331ff938138" +}; + static void MDTestSuite(const Algorithm_t *alg) { |