rippled
base64.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012-2018 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 //
21 // Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
22 //
23 // Distributed under the Boost Software License, Version 1.0. (See accompanying
24 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
25 //
26 
27 /*
28  Portions from http://www.adp-gmbh.ch/cpp/common/base64.html
29  Copyright notice:
30 
31  base64.cpp and base64.h
32 
33  Copyright (C) 2004-2008 RenĂ© Nyffenegger
34 
35  This source code is provided 'as-is', without any express or implied
36  warranty. In no event will the author be held liable for any damages
37  arising from the use of this software.
38 
39  Permission is granted to anyone to use this software for any purpose,
40  including commercial applications, and to alter it and redistribute it
41  freely, subject to the following restrictions:
42 
43  1. The origin of this source code must not be misrepresented; you must not
44  claim that you wrote the original source code. If you use this source code
45  in a product, an acknowledgment in the product documentation would be
46  appreciated but is not required.
47 
48  2. Altered source versions must be plainly marked as such, and must not be
49  misrepresented as being the original source code.
50 
51  3. This notice may not be removed or altered from any source distribution.
52 
53  RenĂ© Nyffenegger rene.nyffenegger@adp-gmbh.ch
54 
55 */
56 
57 #ifndef RIPPLE_BASICS_BASE64_H_INCLUDED
58 #define RIPPLE_BASICS_BASE64_H_INCLUDED
59 
60 #include <string>
61 
62 namespace ripple {
63 
65 base64_encode(std::uint8_t const* data, std::size_t len);
66 
67 inline std::string
69 {
70  return base64_encode(
71  reinterpret_cast<std::uint8_t const*>(s.data()), s.size());
72 }
73 
75 base64_decode(std::string const& data);
76 
77 } // namespace ripple
78 
79 #endif
std::string
STL class.
std::string::size
T size(T... args)
ripple::base64_encode
std::string base64_encode(std::uint8_t const *data, std::size_t len)
Definition: base64.cpp:236
ripple::base64_decode
std::string base64_decode(std::string const &data)
Definition: base64.cpp:245
std::uint8_t
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
std::size_t
std::string::data
T data(T... args)
string