summaryrefslogtreecommitdiffstats
path: root/lib/cryptopp/base32.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-11-27 22:35:13 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-11-27 22:35:13 +0100
commita6630d32394120a78af56bc612fa3c3449283248 (patch)
tree2c791266b0f213cd56961299da8d2258b8f85d8e /lib/cryptopp/base32.h
parentFixed spawn point being generally in an ocean (diff)
parentVoronoi-related biomegens use the new cVoronoiMap class. (diff)
downloadcuberite-a6630d32394120a78af56bc612fa3c3449283248.tar
cuberite-a6630d32394120a78af56bc612fa3c3449283248.tar.gz
cuberite-a6630d32394120a78af56bc612fa3c3449283248.tar.bz2
cuberite-a6630d32394120a78af56bc612fa3c3449283248.tar.lz
cuberite-a6630d32394120a78af56bc612fa3c3449283248.tar.xz
cuberite-a6630d32394120a78af56bc612fa3c3449283248.tar.zst
cuberite-a6630d32394120a78af56bc612fa3c3449283248.zip
Diffstat (limited to 'lib/cryptopp/base32.h')
-rw-r--r--lib/cryptopp/base32.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/cryptopp/base32.h b/lib/cryptopp/base32.h
new file mode 100644
index 000000000..cb1e1af8d
--- /dev/null
+++ b/lib/cryptopp/base32.h
@@ -0,0 +1,38 @@
+#ifndef CRYPTOPP_BASE32_H
+#define CRYPTOPP_BASE32_H
+
+#include "basecode.h"
+
+NAMESPACE_BEGIN(CryptoPP)
+
+//! Converts given data to base 32, the default code is based on draft-ietf-idn-dude-02.txt
+/*! To specify alternative code, call Initialize() with EncodingLookupArray parameter. */
+class Base32Encoder : public SimpleProxyFilter
+{
+public:
+ Base32Encoder(BufferedTransformation *attachment = NULL, bool uppercase = true, int outputGroupSize = 0, const std::string &separator = ":", const std::string &terminator = "")
+ : SimpleProxyFilter(new BaseN_Encoder(new Grouper), attachment)
+ {
+ IsolatedInitialize(MakeParameters(Name::Uppercase(), uppercase)(Name::GroupSize(), outputGroupSize)(Name::Separator(), ConstByteArrayParameter(separator)));
+ }
+
+ void IsolatedInitialize(const NameValuePairs &parameters);
+};
+
+//! Decode base 32 data back to bytes, the default code is based on draft-ietf-idn-dude-02.txt
+/*! To specify alternative code, call Initialize() with DecodingLookupArray parameter. */
+class Base32Decoder : public BaseN_Decoder
+{
+public:
+ Base32Decoder(BufferedTransformation *attachment = NULL)
+ : BaseN_Decoder(GetDefaultDecodingLookupArray(), 5, attachment) {}
+
+ void IsolatedInitialize(const NameValuePairs &parameters);
+
+private:
+ static const int * CRYPTOPP_API GetDefaultDecodingLookupArray();
+};
+
+NAMESPACE_END
+
+#endif