Mercurial > sci
comparison base64.h @ 1:5afdb14df924
sci: add support for storing results
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 08 Jun 2021 08:40:01 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:f1de39079243 | 1:5afdb14df924 |
---|---|
1 /* | |
2 * base64.h -- base64 encoding and decoding | |
3 * | |
4 * Copyright (c) 2013-2021 David Demelier <markand@malikania.fr> | |
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 #include <stddef.h> | |
23 | |
24 #if defined(__cplusplus) | |
25 extern "C" { | |
26 #endif | |
27 | |
28 #define B64_ENCODE_LENGTH(x) (4 * ((x) / 3 + 1)) | |
29 #define B64_DECODE_LENGTH(x) (3 * ((x) / 4)) | |
30 | |
31 int | |
32 b64_isbase64(unsigned char ch); | |
33 | |
34 int | |
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 | |
43 size_t | |
44 b64_encode(const char *src, size_t srcsz, char *dst, size_t dstsz); | |
45 | |
46 size_t | |
47 b64_decode(const char *src, size_t srcsz, char *dst, size_t dstsz); | |
48 | |
49 #if defined(__cplusplus) | |
50 } | |
51 #endif | |
52 | |
53 #endif /* !BASE64_H */ |