haproxy/include/common/base64.h
Willy Tarreau c01062bead [MINOR] add encode/decode function for 30-bit integers from/to base64
These functions only require 5 chars to encode 30 bits, and don't expect
any padding. They will be used to encode dates in cookies.
(cherry picked from commit a7e2b5fc4612994c7b13bcb103a4a2c3ecd6438a)
2010-10-30 19:04:33 +02:00

27 lines
735 B
C

/*
* include/common/base64.h
* Ascii to Base64 conversion as described in RFC1421.
*
* Copyright 2006-2010 Willy Tarreau <w@1wt.eu>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
*/
#ifndef _COMMON_BASE64_H
#define _COMMON_BASE64_H
#include <common/config.h>
int a2base64(char *in, int ilen, char *out, int olen);
int base64dec(const char *in, size_t ilen, char *out, size_t olen);
const char *s30tob64(int in, char *out);
int b64tos30(const char *in);
extern const char base64tab[];
#endif /* _COMMON_BASE64_H */