From 85b12e691577b4d4fe09b80b06e91a801dc3dfa9 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 1 Sep 2024 18:12:21 +0200 Subject: Move test files into t/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- rawshake256.c | 81 ----------------------------------------------------------- 1 file changed, 81 deletions(-) delete mode 100644 rawshake256.c (limited to 'rawshake256.c') diff --git a/rawshake256.c b/rawshake256.c deleted file mode 100644 index e7836f0..0000000 --- a/rawshake256.c +++ /dev/null @@ -1,81 +0,0 @@ -/* See LICENSE file for copyright and license details. */ -#ifdef SUPPORT_SHAKE -# define TEST -# include "common.h" - - -#define MSG1600_32 "\xA3\xA3\xA3\xA3" -#define MSG1600_160 MSG1600_32 MSG1600_32 MSG1600_32 MSG1600_32 MSG1600_32 -#define MSG1600_800 MSG1600_160 MSG1600_160 MSG1600_160 MSG1600_160 MSG1600_160 -#define MSG1600 MSG1600_800 MSG1600_800 - - -static struct testcase testcases[] = { - {1, 0, "", "3a1108d4a90a31b85a10bdce77f4bfbdcc5b1d70dd405686f8bbde834aa1a410"}, - {1, 0, MSG1600, "f353b1260d7a0adb3f5c08bf292f3372ad3ee4630d56cf11ba15ddfb2e70e7a2"} -}; - - -#else -# define TEST_UNSUPPORTED -# include "common.h" -#endif - - -static int -main_test(void) -{ - TEST_MAIN("RawSHAKE256", RAWSHAKE256); -} - - -int -main(void) -{ -#ifdef SUPPORT_RAWSHAKE - struct libhashsum_hasher hasher; - char hexsum[1024]; -#endif - - int r = main_test(); - if (r) - return r; - - ASSERT(!libhashsum_init_rawshake256_hasher(&hasher, 8)); - ASSERT(!strcmp(hasher.algorithm_string, "RawSHAKE256[n=8]")); - ASSERT(!hasher.finalise_const(&hasher, "", 0, 0)); - ASSERT(hasher.hash_size == 1); - hex(hexsum, hasher.hash_output, hasher.hash_size); - ASSERT(!strcmp(hexsum, "3a")); - - ASSERT(!libhashsum_init_rawshake256_hasher(&hasher, 32)); - ASSERT(!strcmp(hasher.algorithm_string, "RawSHAKE256[n=32]")); - ASSERT(!hasher.finalise_const(&hasher, "", 0, 0)); - ASSERT(hasher.hash_size == 4); - hex(hexsum, hasher.hash_output, hasher.hash_size); - ASSERT(!strcmp(hexsum, "3a1108d4")); - - ASSERT(!libhashsum_init_rawshake256_hasher(&hasher, 32)); - ASSERT(!strcmp(hasher.algorithm_string, "RawSHAKE256[n=32]")); - ASSERT(!hasher.finalise_const(&hasher, MSG1600, 1600/8, 0)); - ASSERT(hasher.hash_size == 4); - hex(hexsum, hasher.hash_output, hasher.hash_size); - ASSERT(!strcmp(hexsum, "f353b126")); - - ASSERT(!libhashsum_init_rawshake256_hasher(&hasher, 256)); - ASSERT(!strcmp(hasher.algorithm_string, "RawSHAKE256")); - ASSERT(!hasher.finalise_const(&hasher, MSG1600, 1600/8, 0)); - ASSERT(hasher.hash_size == 256/8); - hex(hexsum, hasher.hash_output, hasher.hash_size); - ASSERT(!strcmp(hexsum, "f353b1260d7a0adb3f5c08bf292f3372ad3ee4630d56cf11ba15ddfb2e70e7a2")); - - ASSERT(!libhashsum_init_rawshake256_hasher(&hasher, 512)); - ASSERT(!strcmp(hasher.algorithm_string, "RawSHAKE256[n=512]")); - ASSERT(!hasher.finalise_const(&hasher, MSG1600, 1600/8, 0)); - ASSERT(hasher.hash_size == 512/8); - hex(hexsum, hasher.hash_output, hasher.hash_size); - ASSERT(!strcmp(hexsum, "f353b1260d7a0adb3f5c08bf292f3372ad3ee4630d56cf11ba15ddfb2e70e7a2" - "3898431eb2500666c27251025869b0a6251029ba184e6075f5b3118cdc4abaa9")); - - return 0; -} -- cgit v1.2.3-70-g09d2