Пример #1
0
int main(void) {
	printf("Testsystem for %s\n", pi_cipher_name); fflush(NULL);

#if PI_SIZE == 16
	size_t key_sizes[] = { 96, 128 };
	size_t npub_sizes[] = { 4 };
#elif PI_SIZE == 32
	size_t key_sizes[] = { 128, 256 };
	size_t npub_sizes[] = { 16 };
#elif PI_SIZE == 64
	size_t key_sizes[] = { 128, 256 };
	size_t npub_sizes[] = { 16 };
#else
#error
#endif

	int i, j;
	char fname[128];
	for (i = 0; i < NUMOF(key_sizes); ++i) {
		for (j = 0; j < NUMOF(npub_sizes); ++j) {
			snprintf(fname, sizeof(fname), "testvectors/%s%03zuv2_%zu.test-vectors", pi_cipher_name, key_sizes[i], npub_sizes[j]);
			freopen(fname, "w", stdout);
			printf("# Testvectors for %s\n", pi_cipher_name);
			printf("#   key size: %zu bits\n", key_sizes[i]);
			printf("#   nonce size: %zu bits\n\n", npub_sizes[j] * 8);
			generate_testvectors(key_sizes[i] / 8, npub_sizes[j]);
			fclose(stdout);
		}
	}

}
Пример #2
0
int main(int argc, char *argv[])
{
    const char *type = (argc > 1) ? argv[1] : "i";
    generate_testvectors(type);
    return ARGON2_OK;
}