[svn] / ecrypt / trunk / submissions / tsc-3 / ref / unused / main.c  

svn: ecrypt/trunk/submissions/tsc-3/ref/unused/main.c

File: [svn] / ecrypt / trunk / submissions / tsc-3 / ref / unused / main.c (download) (as text)
Revision: 1, Sun Jun 26 18:46:26 2005 UTC (7 years, 11 months ago) by cdecanni
File size: 1172 byte(s)
* imported original ECRYPT submissions after first automatic cleanup.
#include <stdio.h>
#include <stdlib.h>
#include "ecrypt-sync.h"

void generate_testvector(void);

int main(void)
{
	ECRYPT_ctx state;
	u8 text[64];
	u32 i, j;

	printf(
		"\n"
		"Below is a short keystream generated from the all-zero state.\n"
		"This should be a lot more helpful then the testvectors when\n"
		"implementing TSC-3 for the first time.\n\n"
		"All printed numbers are in hexadecimal notation, with MSB to\n"
		"the left and LSB to the right.\n\n"
		"                                   state\n"
		"     output         x_3        x_2        x_1        x_0\n"
		);

	for (i = 0; i < 4; i++) state.r[i] = 0;
	printf ("-1              ");
	for (i = 0; i < 4; i++)
	{
		printf ("%.2x" ,  (u8) (state.r[3-i] >> 32));
		printf ("%.8x ", (u32) (state.r[3-i]      ));
	}
	printf ("\n");

	for (i = 0; i < 20; i++)
	{
		ECRYPT_keystream_blocks (&state, text, 1);
		printf ("%2i  ", i);
		for (j = 0; j < 4; j++) printf ("%.2x", text[3-j]);
		printf (" <= ");
		for (j = 0; j < 4; j++)
		{
			printf ("%.2x" ,  (u8) (state.r[3-j] >> 32));
			printf ("%.8x ", (u32) (state.r[3-j]      ));
		}
		printf ("\n");
	}

	printf ("\n");
	generate_testvector ();

	exit (0);
}

eSTREAM Project

Powered by ViewCVS 1.0-dev
(Powered by Apache)

ViewCVS and CVS Help