Security Scol plugin
base32.h
Go to the documentation of this file.
1// base32.h - written and placed in the public domain by Frank Palazzolo, based on hex.cpp by Wei Dai
2// extended hex alphabet added by JW in November, 2017.
3
6
7#ifndef CRYPTOPP_BASE32_H
8#define CRYPTOPP_BASE32_H
9
10#include "cryptlib.h"
11#include "basecode.h"
12
13NAMESPACE_BEGIN(CryptoPP)
14
15
19{
20public:
30 Base32Encoder(BufferedTransformation *attachment = NULLPTR, bool uppercase = true, int groupSize = 0, const std::string &separator = ":", const std::string &terminator = "")
31 : SimpleProxyFilter(new BaseN_Encoder(new Grouper), attachment)
32 {
33 IsolatedInitialize(MakeParameters(Name::Uppercase(), uppercase)(Name::GroupSize(), groupSize)(Name::Separator(), ConstByteArrayParameter(separator))(Name::Terminator(), ConstByteArrayParameter(terminator)));
34 }
35
56 void IsolatedInitialize(const NameValuePairs &parameters);
57};
58
63{
64public:
69 : BaseN_Decoder(GetDefaultDecodingLookupArray(), 5, attachment) {}
70
87 void IsolatedInitialize(const NameValuePairs &parameters);
88
89private:
92 static const int * CRYPTOPP_API GetDefaultDecodingLookupArray();
93};
94
100{
101public:
111 Base32HexEncoder(BufferedTransformation *attachment = NULLPTR, bool uppercase = true, int groupSize = 0, const std::string &separator = ":", const std::string &terminator = "")
112 : SimpleProxyFilter(new BaseN_Encoder(new Grouper), attachment)
113 {
114 IsolatedInitialize(MakeParameters(Name::Uppercase(), uppercase)(Name::GroupSize(), groupSize)(Name::Separator(), ConstByteArrayParameter(separator))(Name::Terminator(), ConstByteArrayParameter(terminator)));
115 }
116
127 void IsolatedInitialize(const NameValuePairs &parameters);
128};
129
135{
136public:
141 : BaseN_Decoder(GetDefaultDecodingLookupArray(), 5, attachment) {}
142
148 void IsolatedInitialize(const NameValuePairs &parameters);
149
150private:
153 static const int * CRYPTOPP_API GetDefaultDecodingLookupArray();
154};
155
156NAMESPACE_END
157
158#endif
AlgorithmParameters MakeParameters(const char *name, const T &value, bool throwIfNotUsed=true)
Create an object that implements NameValuePairs.
Definition algparam.h:508
Base classes for working with encoders and decoders.
Base32 decodes data using DUDE encoding.
Definition base32.h:63
Base32Decoder(BufferedTransformation *attachment=NULLPTR)
Construct a Base32Decoder.
Definition base32.h:68
void IsolatedInitialize(const NameValuePairs &parameters)
Initialize or reinitialize this object, without signal propagation.
Definition base32.cpp:63
Base32 encodes data using DUDE encoding.
Definition base32.h:19
Base32Encoder(BufferedTransformation *attachment=NULLPTR, bool uppercase=true, int groupSize=0, const std::string &separator=":", const std::string &terminator="")
Construct a Base32Encoder.
Definition base32.h:30
Base32 decodes data using extended hex.
Definition base32.h:135
void IsolatedInitialize(const NameValuePairs &parameters)
Initialize or reinitialize this object, without signal propagation.
Definition base32.cpp:84
Base32HexDecoder(BufferedTransformation *attachment=NULLPTR)
Construct a Base32HexDecoder.
Definition base32.h:140
Base32 encodes data using extended hex.
Definition base32.h:100
Base32HexEncoder(BufferedTransformation *attachment=NULLPTR, bool uppercase=true, int groupSize=0, const std::string &separator=":", const std::string &terminator="")
Construct a Base32HexEncoder.
Definition base32.h:111
void IsolatedInitialize(const NameValuePairs &parameters)
Initialize or reinitialize this object, without signal propagation.
Definition base32.cpp:76
Decoder for bases that are a power of 2.
Definition basecode.h:59
Encoder for bases that are a power of 2.
Definition basecode.h:18
Interface for buffered transformations.
Definition cryptlib.h:1652
Used to pass byte array input as part of a NameValuePairs object.
Definition algparam.h:25
Filter that breaks input stream into groups of fixed size.
Definition basecode.h:113
Interface for retrieving values given their names.
Definition cryptlib.h:322
Proxy filter that doesn't modify the underlying filter's input or output.
Definition filters.h:1065
Abstract base classes that provide a uniform interface to this library.