Mercurial > libbase64
view 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 |
line wrap: on
line source
/* * base64.h -- base64 encoding and decoding * * Copyright (c) 2013-2021 David Demelier <markand@malikania.fr> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef BASE64_H #define BASE64_H #include <stddef.h> #if defined(__cplusplus) extern "C" { #endif #define B64_ENCODE_LENGTH(x) (4 * ((x) / 3 + 1)) #define B64_DECODE_LENGTH(x) (3 * ((x) / 4)) int b64_isbase64(unsigned char ch); int b64_isvalid(unsigned char ch); unsigned char b64_lookup(unsigned char value); unsigned char b64_rlookup(unsigned char ch); size_t b64_encode(const char *src, size_t srcsz, char *dst, size_t dstsz); size_t b64_decode(const char *src, size_t srcsz, char *dst, size_t dstsz); #if defined(__cplusplus) } #endif #endif /* !BASE64_H */