Mercurial > dropbear
diff demos/test/base64_test.c @ 15:6362d3854bb4 libtomcrypt-orig
0.96 release of LibTomCrypt
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 15 Jun 2004 14:07:21 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/demos/test/base64_test.c Tue Jun 15 14:07:21 2004 +0000 @@ -0,0 +1,20 @@ +#include "test.h" + +int base64_test(void) +{ + unsigned char in[64], out[256], tmp[64]; + unsigned long x, l1, l2; + + for (x = 0; x < 64; x++) { + yarrow_read(in, x, &test_yarrow); + l1 = sizeof(out); + DO(base64_encode(in, x, out, &l1)); + l2 = sizeof(tmp); + DO(base64_decode(out, l1, tmp, &l2)); + if (l2 != x || memcmp(tmp, in, x)) { + printf("base64 failed %lu %lu %lu", x, l1, l2); + return 1; + } + } + return 0; +}