MCPcopy Create free account
hub / github.com/catboost/catboost / HexEncode

Function HexEncode

util/stream/hex.cpp:6–16  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4#include <util/string/hex.h>
5
6void HexEncode(const void* in, size_t len, IOutputStream& out) {
7 static const size_t NUM_OF_BYTES = 32;
8 char buffer[NUM_OF_BYTES * 2];
9
10 auto current = static_cast<const char*>(in);
11 for (size_t take = 0; len; current += take, len -= take) {
12 take = Min(NUM_OF_BYTES, len);
13 HexEncode(current, take, buffer);
14 out.Write(buffer, take * 2);
15 }
16}
17
18void HexDecode(const void* in, size_t len, IOutputStream& out) {
19 Y_ENSURE(!(len & 1), TStringBuf("Odd buffer length passed to HexDecode"));

Callers 1

TestImplFunction · 0.70

Calls 2

MinFunction · 0.50
WriteMethod · 0.45

Tested by 1

TestImplFunction · 0.56