Security Scol plugin
hex.h
Go to the documentation of this file.
1// hex.h - originally written and placed in the public domain by Wei Dai
2
5
6#ifndef CRYPTOPP_HEX_H
7#define CRYPTOPP_HEX_H
8
9#include "cryptlib.h"
10#include "basecode.h"
11
12NAMESPACE_BEGIN(CryptoPP)
13
14
15class CRYPTOPP_DLL HexEncoder : public SimpleProxyFilter
16{
17public:
24 HexEncoder(BufferedTransformation *attachment = NULLPTR, bool uppercase = true, int groupSize = 0, const std::string &separator = ":", const std::string &terminator = "")
25 : SimpleProxyFilter(new BaseN_Encoder(new Grouper), attachment)
26 {
27 IsolatedInitialize(MakeParameters(Name::Uppercase(), uppercase)(Name::GroupSize(), groupSize)(Name::Separator(), ConstByteArrayParameter(separator))(Name::Terminator(), ConstByteArrayParameter(terminator)));
28 }
29
30 void IsolatedInitialize(const NameValuePairs &parameters);
31};
32
34class CRYPTOPP_DLL HexDecoder : public BaseN_Decoder
35{
36public:
39 HexDecoder(BufferedTransformation *attachment = NULLPTR)
40 : BaseN_Decoder(GetDefaultDecodingLookupArray(), 4, attachment) {}
41
42 void IsolatedInitialize(const NameValuePairs &parameters);
43
44private:
45 static const int * CRYPTOPP_API GetDefaultDecodingLookupArray();
46};
47
48NAMESPACE_END
49
50#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.
Decoder for bases that are a power of 2.
Definition basecode.h:59
void IsolatedInitialize(const NameValuePairs &parameters)
Initialize or reinitialize this object, without signal propagation.
Definition basecode.cpp:115
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
Decode base 16 data back to bytes.
Definition hex.h:35
HexDecoder(BufferedTransformation *attachment=NULLPTR)
Construct a HexDecoder.
Definition hex.h:39
Converts given data to base 16.
Definition hex.h:16
HexEncoder(BufferedTransformation *attachment=NULLPTR, bool uppercase=true, int groupSize=0, const std::string &separator=":", const std::string &terminator="")
Construct a HexEncoder.
Definition hex.h:24
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.