monotone

monotone Mtn Source Tree

Root/cryptopp/hex.cpp

1// hex.cpp - written and placed in the public domain by Wei Dai
2
3#include "pch.h"
4#include "hex.h"
5
6NAMESPACE_BEGIN(CryptoPP)
7
8static const byte s_vecUpper[] = "0123456789ABCDEF";
9static const byte s_vecLower[] = "0123456789abcdef";
10
11void HexEncoder::IsolatedInitialize(const NameValuePairs &parameters)
12{
13bool uppercase = parameters.GetValueWithDefault("Uppercase", true);
14m_filter->Initialize(CombinedNameValuePairs(
15parameters,
16MakeParameters("EncodingLookupArray", uppercase ? &s_vecUpper[0] : &s_vecLower[0])("Log2Base", 4)));
17}
18
19const int *HexDecoder::GetDecodingLookupArray()
20{
21static bool s_initialized = false;
22static int s_array[256];
23
24if (!s_initialized)
25{
26InitializeDecodingLookupArray(s_array, s_vecUpper, 16, true);
27s_initialized = true;
28}
29return s_array;
30}
31
32NAMESPACE_END

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status