cast128-test.c 690 Bytes
Newer Older
1
2
3
4
#include "testutils.h"
#include "cast128.h"

int
Niels Möller's avatar
Niels Möller committed
5
test_main(void)
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{
  /* Test vectors from B.1. Single Plaintext-Key-Ciphertext Sets, RFC
   * 2144 */

  /* 128 bit key */
  test_cipher(&nettle_cast128,
	      HL("01 23 45 67 12 34 56 78"
		 "23 45 67 89 34 56 78 9A"),
	      HL("01 23 45 67 89 AB CD EF"),
	      H("23 8B 4F E5 84 7E 44 B2"));
  
  /* 80 bit key */
  test_cipher(&nettle_cast128,
	      HL("01 23 45 67 12 34 56 78 23 45"),
	      HL("01 23 45 67 89 AB CD EF"),
	      H("EB 6A 71 1A 2C 02 27 1B"));

  /* 40 bit key */
  test_cipher(&nettle_cast128,
	      HL("01 23 45 67 12"),
	      HL("01 23 45 67 89 AB CD EF"),
	      H("7A C8 16 D1 6E 9B 30 2E"));

  SUCCESS();
}