2 Copyright (c) 2013 Eugene Crosser
4 This software is provided 'as-is', without any express or implied
5 warranty. In no event will the authors be held liable for any damages
6 arising from the use of this software.
8 Permission is granted to anyone to use this software for any purpose,
9 including commercial applications, and to alter it and redistribute it
10 freely, subject to the following restrictions:
12 1. The origin of this software must not be misrepresented; you must
13 not claim that you wrote the original software. If you use this
14 software in a product, an acknowledgment in the product documentation
15 would be appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must
18 not be misrepresented as being the original software.
20 3. This notice may not be removed or altered from any source
33 static char src[40] = "Quick brown fox jumps over the lazy dog";
35 int main(int argc, char *argv[])
41 printf("src=\"%s\" (%d)\n", src, (int)sizeof(src));
43 if (b64_encode(src, sizeof(src), b64, &bsize)) {
44 fprintf(stderr, "encode error\n");
47 printf("b64=\"%s\" (%d)\n", b64, bsize);
49 if (b64_decode(b64, dst, &dsize)) {
50 fprintf(stderr, "decode error\n");
53 printf("dst=\"%s\" (%d)\n", dst, dsize);
54 return !(dsize == sizeof(src) && !memcmp(src, dst, dsize));