2 * Written in 2013 by Gregor Pintar <grpintar@gmail.com>
4 * To the extent possible under law, the author(s) have dedicated
5 * all copyright and related and neighboring rights to this software
6 * to the public domain worldwide.
8 * This software is distributed without any warranty.
10 * You should have received a copy of the CC0 Public Domain Dedication.
11 * If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
17 #include <kripto/block/cast5.h>
26 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
27 0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9A
31 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF
35 0x23, 0x8B, 0x4F, 0xE5, 0x84, 0x7E, 0x44, 0xB2
38 puts("kripto_block_cast5");
41 s
= kripto_block_create(kripto_block_cast5
, 0, k
, 16);
44 kripto_block_encrypt(s
, pt
, t
);
45 for(i
= 0; i
< 8; i
++) if(t
[i
] != ct
[i
])
47 puts("128-bit key encrypt: FAIL");
50 if(i
== 8) puts("128-bit key encrypt: OK");
52 kripto_block_decrypt(s
, ct
, t
);
53 for(i
= 0; i
< 8; i
++) if(t
[i
] != pt
[i
])
55 puts("128-bit key decrypt: FAIL");
58 if(i
== 8) puts("128-bit key decrypt: OK");
60 kripto_block_destroy(s
);