Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# hex.cpp

    00001 // hex.cpp - written and placed in the public domain by Wei Dai
    00002
    00003 #include "pch.h"
    00004
    00005 #ifndef CRYPTOPP_IMPORTS
    00006
    00007 #include "hex.h"
    00008
    00009 NAMESPACE_BEGIN(CryptoPP)
    00010
    00011 static const byte s_vecUpper[] = "0123456789ABCDEF";
    00012 static const byte s_vecLower[] = "0123456789abcdef";
    00013
    00014 void HexEncoder::IsolatedInitialize(const NameValuePairs &parameters)
    00015 {
    00016         bool uppercase = parameters.GetValueWithDefault("Uppercase", true);
    00017         m_filter->Initialize(CombinedNameValuePairs(
    00018                 parameters,
    00019                 MakeParameters("EncodingLookupArray", uppercase ? &s_vecUpper[0] : &s_vecLower[0])("Log2Base", 4)));
    00020 }
    00021
    00022 const int *HexDecoder::GetDecodingLookupArray()
    00023 {
    00024         static bool s_initialized = false;
    00025         static int s_array[256];
    00026
    00027         if (!s_initialized)
    00028         {
    00029                 InitializeDecodingLookupArray(s_array, s_vecUpper, 16, true);
    00030                 s_initialized = true;
    00031         }
    00032         return s_array;
    00033 }
    00034
    00035 NAMESPACE_END
    00036
    00037 #endif