summaryrefslogtreecommitdiffstatshomepage
path: root/src/tools/base64.h
blob: 37cf1b9c3edc5200775baa0431400f286645056c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* Copyright (C) 2015-2017 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved. */

#ifndef BASE64_H
#define BASE64_H

#include <stdbool.h>
#include <stdint.h>
#include "../uapi.h"

#define WG_KEY_LEN_BASE64 ((((WG_KEY_LEN) + 2) / 3) * 4 + 1)

void key_to_base64(char base64[static WG_KEY_LEN_BASE64], const uint8_t key[static WG_KEY_LEN]);
bool key_from_base64(uint8_t key[static WG_KEY_LEN], const char *base64);

#endif