libacfutils
A general purpose library of utility functions designed to make it easier to develop addons for the X-Plane flight simulator.
Loading...
Searching...
No Matches
base64.h
Go to the documentation of this file.
1/*
2 * CDDL HEADER START
3 *
4 * This file and its contents are supplied under the terms of the
5 * Common Development and Distribution License ("CDDL"), version 1.0.
6 * You may only use this file in accordance with the terms of version
7 * 1.0 of the CDDL.
8 *
9 * A full copy of the text of the CDDL should have accompanied this
10 * source. A copy of the CDDL is also available via the Internet at
11 * http://www.illumos.org/license/CDDL.
12 *
13 * CDDL HEADER END
14 */
15/*
16 * Copyright 2023 Saso Kiselkov. All rights reserved.
17 */
20#ifndef _ACFUTILS_BASE64_H_
21#define _ACFUTILS_BASE64_H_
22
23#include <stdlib.h>
24#include <stdint.h>
25
26#include "core.h"
27
32#define BASE64_ENC_SIZE(__raw_size__) ((((__raw_size__) + 2) / 3) * 4)
33
41#define BASE64_DEC_SIZE(__enc_size__) (((__enc_size__) / 4) * 3)
42
43API_EXPORT size_t lacf_base64_encode(const uint8_t *raw, size_t raw_size,
44 uint8_t *encoded);
45API_EXPORT size_t lacf_base64_encode2(const uint8_t *raw, size_t raw_size,
46 uint8_t *encoded, int mod);
47API_EXPORT ssize_t lacf_base64_decode(const uint8_t *encoded,
48 size_t encoded_size, uint8_t *raw);
49API_EXPORT ssize_t lacf_base64_decode2(const uint8_t *encoded,
50 size_t encoded_size, uint8_t *raw, int mod);
51
52#endif /* _ACFUTILS_BASE64_H_ */
size_t lacf_base64_encode2(const uint8_t *raw, size_t raw_size, uint8_t *encoded, int mod)
Definition base64.c:111
size_t lacf_base64_encode(const uint8_t *raw, size_t raw_size, uint8_t *encoded)
Definition base64.c:93
ssize_t lacf_base64_decode(const uint8_t *encoded, size_t encoded_size, uint8_t *raw)
Definition base64.c:182
ssize_t lacf_base64_decode2(const uint8_t *encoded, size_t encoded_size, uint8_t *raw, int mod)
Definition base64.c:199