MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / Decode

Method Decode

extra/yassl/taocrypt/src/coding.cpp:95–124  ·  view source on GitHub ↗

Hex Decode

Source from the content-addressed store, hash-verified

93
94// Hex Decode
95void HexDecoder::Decode()
96{
97 word32 bytes = coded_.size();
98 decoded_.New(bytes / 2);
99
100 word32 i(0);
101
102 while (bytes) {
103 byte b = coded_.next() - 0x30; // 0 starts at 0x30
104 byte b2 = coded_.next() - 0x30;
105
106 // sanity checks
107 if (b >= sizeof(hexDecode)/sizeof(hexDecode[0])) {
108 coded_.SetError(PEM_E);
109 return;
110 }
111 if (b2 >= sizeof(hexDecode)/sizeof(hexDecode[0])) {
112 coded_.SetError(PEM_E);
113 return;
114 }
115
116 b = hexDecode[b];
117 b2 = hexDecode[b2];
118
119 decoded_[i++] = (b << 4) | b2;
120 bytes -= 2;
121 }
122
123 coded_.reset(decoded_);
124}
125
126
127// Base 64 Encode

Callers

nothing calls this directly

Calls 6

NewMethod · 0.80
sizeMethod · 0.45
nextMethod · 0.45
SetErrorMethod · 0.45
resetMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected