xmss-KAT-generator/test/test_chacha.c

37 lines
581 B
C
Raw Normal View History

2015-08-11 11:08:27 +01:00
#include <stdio.h>
#include "../prg.h"
static void hexdump(unsigned char *a, size_t len)
{
size_t i;
for (i = 0; i < len; i++)
printf("%02x", a[i]);
}
int main()
{
2015-10-28 14:49:46 +00:00
int n = 32;
2015-08-11 11:08:27 +01:00
unsigned char seed[32] = {0};
2015-10-28 14:49:46 +00:00
// unsigned char seed[64] = {0,0};
2015-10-28 14:49:46 +00:00
unsigned char out[2*n];
2015-08-11 11:08:27 +01:00
unsigned char addr[16] = {2};
printf("Case 1: All 0\n");
2015-10-28 14:49:46 +00:00
prg(out, 2*n, seed, n);
2015-08-11 11:08:27 +01:00
printf("\n");
2015-10-28 14:49:46 +00:00
hexdump(out, 2*n);
2015-08-11 11:08:27 +01:00
printf("\n");
2015-08-11 11:08:27 +01:00
printf("Case 2: key = 1\n");
seed[31] = 1;
2015-10-28 14:49:46 +00:00
prg_with_counter(out, seed, n, addr);
2015-08-11 11:08:27 +01:00
printf("\n");
2015-10-28 14:49:46 +00:00
hexdump(out, n);
2015-08-11 11:08:27 +01:00
printf("\n");
return 0;
}