Fabcoin Core  0.16.2
P2P Digital Currency
base32.cpp
Go to the documentation of this file.
1 // base32.cpp - written and placed in the public domain by Frank Palazzolo, based on hex.cpp by Wei Dai
2 
3 #include "pch.h"
4 #include "base32.h"
5 
7 
8 namespace
9 {
10  const byte s_vecUpper[] = "ABCDEFGHIJKMNPQRSTUVWXYZ23456789";
11  const byte s_vecLower[] = "abcdefghijkmnpqrstuvwxyz23456789";
12 }
13 
15 {
16  bool uppercase = parameters.GetValueWithDefault(Name::Uppercase(), true);
18  parameters,
19  MakeParameters(Name::EncodingLookupArray(), uppercase ? &s_vecUpper[0] : &s_vecLower[0], false)(Name::Log2Base(), 5, true)));
20 }
21 
23 {
25  parameters,
26  MakeParameters(Name::DecodingLookupArray(), GetDefaultDecodingLookupArray(), false)(Name::Log2Base(), 5, true)));
27 }
28 
30 {
31  static volatile bool s_initialized = false;
32  static int s_array[256];
33 
34  if (!s_initialized)
35  {
36  InitializeDecodingLookupArray(s_array, s_vecUpper, 32, true);
37  s_initialized = true;
38  }
39  return s_array;
40 }
41 
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
static const int *CRYPTOPP_API GetDefaultDecodingLookupArray()
Provides the default decoding lookup table.
Definition: base32.cpp:29
Combines two sets of NameValuePairs.
Definition: algparam.h:135
Classes for Base32Encoder and Base32Decoder.
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
void IsolatedInitialize(const NameValuePairs &parameters)
Initialize or reinitialize this object, without signal propagation.
Definition: base32.cpp:22
#define NAMESPACE_END
Definition: config.h:201
std::vector< char * > parameters
Definition: boostTest.cpp:46
void IsolatedInitialize(const NameValuePairs &parameters)
Initialize or reinitialize this object, without signal propagation.
Definition: base32.cpp:14
virtual void Initialize(const NameValuePairs &parameters=g_nullNameValuePairs, int propagation=-1)
Initialize or reinitialize this object, with signal propagation.
Definition: cryptlib.cpp:435
Interface for retrieving values given their names.
Definition: cryptlib.h:279