Mercurial > libbase64
annotate base64.h @ 33:01c29bee0c54
man: add libbase64.3 manual page
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 02 Jun 2021 16:37:59 +0200 |
parents | c96f2b26678a |
children | e4a6c3f3d0f2 |
rev | line source |
---|---|
19 | 1 /* |
2 * base64.h -- base64 encoding and decoding | |
3 * | |
32
c96f2b26678a
misc: general cleanups
David Demelier <markand@malikania.fr>
parents:
28
diff
changeset
|
4 * Copyright (c) 2013-2021 David Demelier <markand@malikania.fr> |
19 | 5 * |
6 * Permission to use, copy, modify, and/or distribute this software for any | |
7 * purpose with or without fee is hereby granted, provided that the above | |
8 * copyright notice and this permission notice appear in all copies. | |
9 * | |
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
17 */ | |
18 | |
19 #ifndef BASE64_H | |
20 #define BASE64_H | |
21 | |
22 | 22 #include <stddef.h> |
19 | 23 |
24 #if defined(__cplusplus) | |
25 extern "C" { | |
26 #endif | |
27 | |
33
01c29bee0c54
man: add libbase64.3 manual page
David Demelier <markand@malikania.fr>
parents:
32
diff
changeset
|
28 #define B64_ENCODE_LENGTH(x) (4 * ((x) / 3 + 1)) |
01c29bee0c54
man: add libbase64.3 manual page
David Demelier <markand@malikania.fr>
parents:
32
diff
changeset
|
29 #define B64_DECODE_LENGTH(x) (3 * ((x) / 4)) |
01c29bee0c54
man: add libbase64.3 manual page
David Demelier <markand@malikania.fr>
parents:
32
diff
changeset
|
30 |
28
94c8fd9ab0ee
base64: switch to int from bool
David Demelier <markand@malikania.fr>
parents:
25
diff
changeset
|
31 int |
19 | 32 b64_isbase64(unsigned char ch); |
33 | |
28
94c8fd9ab0ee
base64: switch to int from bool
David Demelier <markand@malikania.fr>
parents:
25
diff
changeset
|
34 int |
19 | 35 b64_isvalid(unsigned char ch); |
36 | |
37 unsigned char | |
38 b64_lookup(unsigned char value); | |
39 | |
40 unsigned char | |
41 b64_rlookup(unsigned char ch); | |
42 | |
22 | 43 size_t |
33
01c29bee0c54
man: add libbase64.3 manual page
David Demelier <markand@malikania.fr>
parents:
32
diff
changeset
|
44 b64_encode(const char *src, size_t srcsz, char *dst, size_t dstsz); |
22 | 45 |
46 size_t | |
33
01c29bee0c54
man: add libbase64.3 manual page
David Demelier <markand@malikania.fr>
parents:
32
diff
changeset
|
47 b64_decode(const char *src, size_t srcsz, char *dst, size_t dstsz); |
19 | 48 |
49 #if defined(__cplusplus) | |
50 } | |
51 #endif | |
52 | |
33
01c29bee0c54
man: add libbase64.3 manual page
David Demelier <markand@malikania.fr>
parents:
32
diff
changeset
|
53 #endif /* !BASE64_H */ |