]>
git.ipfire.org Git - thirdparty/hostap.git/blob - tests/test-base64.c
2 * Base64 encoding/decoding (RFC1341) - test program
3 * Copyright (c) 2005, Jouni Malinen <j@w1.fi>
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
9 #include "utils/includes.h"
11 #include "utils/base64.h"
13 int main(int argc
, char *argv
[])
17 unsigned char *buf
, *e
;
20 printf("Usage: base64 <encode|decode> <in file> <out file>\n");
24 buf
= (unsigned char *) os_readfile(argv
[2], &len
);
28 if (strcmp(argv
[1], "encode") == 0)
29 e
= base64_encode(buf
, len
, &elen
);
31 e
= base64_decode(buf
, len
, &elen
);
34 f
= fopen(argv
[3], "w");
37 fwrite(e
, 1, elen
, f
);