Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
base-n.hh
Go to the documentation of this file.
1#pragma once
3
4#include <string>
5#include <span>
6
7namespace nix {
8
9namespace base16 {
10
14[[nodiscard]] constexpr static inline size_t encodedLength(size_t origSize)
15{
16 return origSize * 2;
17}
18
22std::string encode(std::span<const std::byte> b);
23
27std::string decode(std::string_view s);
28
29} // namespace base16
30
31namespace base64 {
32
36[[nodiscard]] constexpr static inline size_t encodedLength(size_t origSize)
37{
38 return ((4 * origSize / 3) + 3) & ~3;
39}
40
44std::string encode(std::span<const std::byte> b);
45
49std::string decode(std::string_view s);
50
51} // namespace base64
52
53} // namespace nix
std::string decode(std::string_view s)
Definition base-n.cc:73
std::string decode(std::string_view s)
Definition base-n.cc:22
std::string encode(std::span< const std::byte > b)
Definition base-n.cc:50
std::string encode(std::span< const std::byte > b)
Definition base-n.cc:11