Fabcoin Core  0.16.2
P2P Digital Currency
hex.cpp
Go to the documentation of this file.
1 // hex.cpp - written and placed in the public domain by Wei Dai
2 
3 #include "pch.h"
4 
5 #ifndef CRYPTOPP_IMPORTS
6 
7 #include "hex.h"
8 
10 
11 namespace
12 {
13  const byte s_vecUpper[] = "0123456789ABCDEF";
14  const byte s_vecLower[] = "0123456789abcdef";
15 }
16 
18 {
19  bool uppercase = parameters.GetValueWithDefault(Name::Uppercase(), true);
21  parameters,
22  MakeParameters(Name::EncodingLookupArray(), uppercase ? &s_vecUpper[0] : &s_vecLower[0], false)(Name::Log2Base(), 4, true)));
23 }
24 
26 {
28  parameters,
29  MakeParameters(Name::DecodingLookupArray(), GetDefaultDecodingLookupArray(), false)(Name::Log2Base(), 4, true)));
30 }
31 
33 {
34  static volatile bool s_initialized = false;
35  static int s_array[256];
36 
37  if (!s_initialized)
38  {
39  InitializeDecodingLookupArray(s_array, s_vecUpper, 16, true);
40  s_initialized = true;
41  }
42  return s_array;
43 }
44 
46 
47 #endif
uint8_t byte
Definition: Common.h:57
member_ptr< BufferedTransformation > m_filter
Definition: filters.h:972
T GetValueWithDefault(const char *name, T defaultValue) const
Get a named value.
Definition: cryptlib.h:350
#define NAMESPACE_BEGIN(x)
Definition: config.h:200
Combines two sets of NameValuePairs.
Definition: algparam.h:135
void IsolatedInitialize(const NameValuePairs &parameters)
Initialize or reinitialize this object, without signal propagation.
Definition: hex.cpp:17
void IsolatedInitialize(const NameValuePairs &parameters)
Initialize or reinitialize this object, without signal propagation.
Definition: basecode.cpp:115
AlgorithmParameters MakeParameters(const char *name, const T &value, bool throwIfNotUsed=true)
Create an object that implements NameValuePairs.
Definition: algparam.h:498
Classes for HexEncoder and HexDecoder.
static const int *CRYPTOPP_API GetDefaultDecodingLookupArray()
Definition: hex.cpp:32
#define NAMESPACE_END
Definition: config.h:201
std::vector< char * > parameters
Definition: boostTest.cpp:46
virtual void Initialize(const NameValuePairs &parameters=g_nullNameValuePairs, int propagation=-1)
Initialize or reinitialize this object, with signal propagation.
Definition: cryptlib.cpp:435
void IsolatedInitialize(const NameValuePairs &parameters)
Initialize or reinitialize this object, without signal propagation.
Definition: hex.cpp:25
Interface for retrieving values given their names.
Definition: cryptlib.h:279