cctools
b64.h
Go to the documentation of this file.
1/*
2Copyright (C) 2022 The University of Notre Dame
3This software is distributed under the GNU General Public License.
4See the file COPYING for details.
5*/
6
7#ifndef B64_H
8#define B64_H
9
10#include "buffer.h"
11
12#include <stddef.h>
13
25static inline size_t b64_size (size_t bloblen)
26{
27 /* Ceil division by 3 multiplied by 4 */
28 return 1 /* NUL byte */ + (bloblen + 3 - 1) / 3 * 4;
29}
30
41int b64_encode(const void *blob, size_t bloblen, buffer_t *b64);
42
52int b64_decode(const char *b64, buffer_t *blob);
53
54#endif /* B64_H */
55
56/* vim: set noexpandtab tabstop=8: */
int b64_encode(const void *blob, size_t bloblen, buffer_t *b64)
Encode a binary blob in base64.
int b64_decode(const char *b64, buffer_t *blob)
Decode a base64 encoded blob.
String Buffer Operations.
Definition buffer.h:26