2 #include "tests/arc4.h"
4 #include "tests/main.h"
6 #define SIZE (1024 * 1024)
16 /* Initialize to 0x5a. */
18 memset (buf, 0x5a, sizeof buf);
20 /* Check that it's all 0x5a. */
22 for (i = 0; i < SIZE; i++)
24 fail ("byte %zu != 0x5a", i);
27 msg ("read/modify/write pass one");
28 arc4_init (&arc4, "foobar", 6);
29 arc4_crypt (&arc4, buf, SIZE);
31 /* Decrypt back to zeros. */
32 msg ("read/modify/write pass two");
33 arc4_init (&arc4, "foobar", 6);
34 arc4_crypt (&arc4, buf, SIZE);
36 /* Check that it's all 0x5a. */
38 for (i = 0; i < SIZE; i++)
40 fail ("byte %zu != 0x5a", i);