| 1 | #include "atheme.h" |
| 2 | |
| 3 | int main(int argc, const char *argv) |
| 4 | { |
| 5 | char b64[] = "Q2hyaXNUZXN0AENocmlzVGVzdABwbXpqZ3VseGF5ZWJjcGJ3cXFkaA=="; |
| 6 | char b64out[BUFSIZE]; |
| 7 | char b64pristine[] = "ChrisTest\0ChrisTest\0pmzjgulxayebcpbwqqdh"; |
| 8 | int rc; |
| 9 | |
| 10 | rc = base64_decode(b64, b64out, BUFSIZE); |
| 11 | |
| 12 | printf("decode: %d sz: %zu\n", rc, sizeof(b64pristine)); |
| 13 | printf("b64pri: %s:%s:%s\n", b64pristine, b64pristine + 10, b64pristine + 20); |
| 14 | printf("b64out: %s:%s:%s\n", b64out, b64out + 10, b64out + 20); |
| 15 | |
| 16 | if (memcmp(b64out, b64pristine, sizeof(b64pristine))) |
| 17 | { |
| 18 | printf("FAIL.\n"); |
| 19 | } |
| 20 | else |
| 21 | { |
| 22 | printf("PASS.\n"); |
| 23 | } |
| 24 | } |