00001
00002
00003 #include "pch.h"
00004 #include "hex.h"
00005
00006 NAMESPACE_BEGIN(CryptoPP)
00007
00008 static const byte s_vecUpper[] = "0123456789ABCDEF";
00009 static const byte s_vecLower[] = "0123456789abcdef";
00010
00011 HexEncoder::HexEncoder(BufferedTransformation *outQueue, bool uppercase)
00012 : Filter(outQueue), m_vec(uppercase ? s_vecUpper : s_vecLower)
00013 {
00014 }
00015
00016 void HexEncoder::Put(const byte *inString, unsigned int length)
00017 {
00018 while (length--)
00019 HexEncoder::Put(*inString++);
00020 }
00021
00022 void HexDecoder::Put(const byte *inString, unsigned int length)
00023 {
00024 while (length--)
00025 HexDecoder::Put(*inString++);
00026 }
00027
00028 void HexDecoder::MessageEnd(int propagate)
00029 {
00030 last = -1;
00031 Filter::MessageEnd(propagate);
00032 }
00033
00034 NAMESPACE_END