aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/sha512.c
diff options
context:
space:
mode:
authorDerek Buitenhuis <derek.buitenhuis@gmail.com>2016-05-11 19:10:10 +0100
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>2016-05-11 19:13:03 +0100
commit96d616052b3d39678e477fa10610ca688f46fff9 (patch)
tree8bd31d06318bc786ea8f1d84f92090c9c860bc11 /libavutil/sha512.c
parent27506aceda8115f82f89691a4441d62a8cf24a6e (diff)
parentd12b5b2f135aade4099f4b26b0fe678656158c13 (diff)
downloadffmpeg-96d616052b3d39678e477fa10610ca688f46fff9.tar.gz
Merge commit 'd12b5b2f135aade4099f4b26b0fe678656158c13'
* commit 'd12b5b2f135aade4099f4b26b0fe678656158c13': build: Split test programs off into separate files Some conversions done by: James Almer <jamrial@gmail.com> Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Diffstat (limited to 'libavutil/sha512.c')
-rw-r--r--libavutil/sha512.c62
1 files changed, 0 insertions, 62 deletions
diff --git a/libavutil/sha512.c b/libavutil/sha512.c
index e2fc58a423..2c5da25591 100644
--- a/libavutil/sha512.c
+++ b/libavutil/sha512.c
@@ -281,65 +281,3 @@ void av_sha512_final(AVSHA512* ctx, uint8_t *digest)
if (ctx->digest_len & 1) /* SHA512/224 is 28 bytes, and is not divisible by 8. */
AV_WB32(digest + i*8, ctx->state[i] >> 32);
}
-
-#ifdef TEST
-#include <stdio.h>
-
-int main(void)
-{
- int i, j, k;
- AVSHA512 ctx;
- unsigned char digest[64];
- static const int lengths[4] = { 224, 256, 384, 512 };
-
- for (j = 0; j < 4; j++) {
- if (j < 2) printf("Testing SHA-512/%d\n", lengths[j]);
- else printf("Testing SHA-%d\n", lengths[j]);
- for (k = 0; k < 3; k++) {
- av_sha512_init(&ctx, lengths[j]);
- if (k == 0)
- av_sha512_update(&ctx, "abc", 3);
- else if (k == 1)
- av_sha512_update(&ctx, "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
- "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu", 112);
- else
- for (i = 0; i < 1000*1000; i++)
- av_sha512_update(&ctx, "a", 1);
- av_sha512_final(&ctx, digest);
- for (i = 0; i < lengths[j] >> 3; i++)
- printf("%02X", digest[i]);
- putchar('\n');
- }
- switch (j) { //test vectors (from FIPS PUB 180-4 Apendix A)
- case 0:
- printf("4634270f 707b6a54 daae7530 460842e2 0e37ed26 5ceee9a4 3e8924aa\n"
- "23fec5bb 94d60b23 30819264 0b0c4533 35d66473 4fe40e72 68674af9\n"
- "37ab331d 76f0d36d e422bd0e deb22a28 accd487b 7a8453ae 965dd287\n");
- break;
- case 1:
- printf("53048e26 81941ef9 9b2e29b7 6b4c7dab e4c2d0c6 34fc6d46 e0e2f131 07e7af23\n"
- "3928e184 fb8690f8 40da3988 121d31be 65cb9d3e f83ee614 6feac861 e19b563a\n"
- "9a59a052 930187a9 7038cae6 92f30708 aa649192 3ef51943 94dc68d5 6c74fb21\n");
- break;
- case 2:
- printf("cb00753f 45a35e8b b5a03d69 9ac65007 272c32ab 0eded163 "
- "1a8b605a 43ff5bed 8086072b a1e7cc23 58baeca1 34c825a7\n"
- "09330c33 f71147e8 3d192fc7 82cd1b47 53111b17 3b3b05d2 "
- "2fa08086 e3b0f712 fcc7c71a 557e2db9 66c3e9fa 91746039\n"
- "9d0e1809 716474cb 086e834e 310a4a1c ed149e9c 00f24852 "
- "7972cec5 704c2a5b 07b8b3dc 38ecc4eb ae97ddd8 7f3d8985\n");
- break;
- case 3:
- printf("ddaf35a1 93617aba cc417349 ae204131 12e6fa4e 89a97ea2 0a9eeee6 4b55d39a "
- "2192992a 274fc1a8 36ba3c23 a3feebbd 454d4423 643ce80e 2a9ac94f a54ca49f\n"
- "8e959b75 dae313da 8cf4f728 14fc143f 8f7779c6 eb9f7fa1 7299aead b6889018 "
- "501d289e 4900f7e4 331b99de c4b5433a c7d329ee b6dd2654 5e96e55b 874be909\n"
- "e718483d 0ce76964 4e2e42c7 bc15b463 8e1f98b1 3b204428 5632a803 afa973eb "
- "de0ff244 877ea60a 4cb0432c e577c31b eb009c5c 2c49aa2e 4eadb217 ad8cc09b\n");
- break;
- }
- }
-
- return 0;
-}
-#endif