diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2016-09-01 11:08:18 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-09-02 13:18:59 (GMT) |
commit | b481ddb3df21e02e16038854ec7d256601717018 (patch) | |
tree | 4e2541ab88950213a938af7e5936492842fa98d1 /Source/cmBase32.h | |
parent | 0c46750d2c4cee401f1cda047a71b0e349678077 (diff) | |
download | CMake-b481ddb3df21e02e16038854ec7d256601717018.zip CMake-b481ddb3df21e02e16038854ec7d256601717018.tar.gz CMake-b481ddb3df21e02e16038854ec7d256601717018.tar.bz2 |
Add cmBase32Encoder class
Diffstat (limited to 'Source/cmBase32.h')
-rw-r--r-- | Source/cmBase32.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Source/cmBase32.h b/Source/cmBase32.h new file mode 100644 index 0000000..66ff8ba --- /dev/null +++ b/Source/cmBase32.h @@ -0,0 +1,42 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2016 Sebastian Holtermann <sebholt@xwmw.org> + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmBase32_h +#define cmBase32_h + +#include <cmConfigure.h> // IWYU pragma: keep + +#include <stddef.h> +#include <string> + +/** \class cmBase32Encoder + * \brief Encodes a byte sequence to a Base32 byte sequence according to + * RFC4648 + * + */ +class cmBase32Encoder +{ +public: + static const char paddingChar = '='; + +public: + cmBase32Encoder(); + ~cmBase32Encoder(); + + // Encodes the given input byte sequence into a string + // @arg input Input data pointer + // @arg len Input data size + // @arg padding Flag to append "=" on demand + std::string encodeString(const unsigned char* input, size_t len, + bool padding = true); +}; + +#endif |