File: base64.h

package info (click to toggle)
libjwt3 3.2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,860 kB
  • sloc: ansic: 8,651; xml: 253; javascript: 187; sh: 45; makefile: 14; ruby: 11
file content (25 lines) | stat: -rw-r--r-- 612 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef BASE64_H
#define BASE64_H

#include <jwt.h>
#include "jwt-private.h"

#define BASE64_ENCODE_OUT_SIZE(s) ((unsigned int)((((s) + 2) / 3) * 4 + 1))
#define BASE64_DECODE_OUT_SIZE(s) ((unsigned int)(((s) / 4) * 3))

/*
 * out is null-terminated encode string.
 * return values is out length, exclusive terminating `\0'
 */
JWT_NO_EXPORT
extern unsigned int base64_encode(const unsigned char *in, unsigned int inlen,
				  char *out);

/*
 * return values is out length
 */
JWT_NO_EXPORT
extern unsigned int base64_decode(const char *in, unsigned int inlen,
				  unsigned char *out);

#endif /* BASE64_H */