diff options
author | pkalinnikov <[email protected]> | 2022-02-10 16:50:15 +0300 |
---|---|---|
committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:50:15 +0300 |
commit | d507a9366b2ab84411afe63fea9fba5498891e1b (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /util/stream/hex.cpp | |
parent | 9e33e026829d561d6fd46d72b88c367952e08075 (diff) |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'util/stream/hex.cpp')
-rw-r--r-- | util/stream/hex.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/util/stream/hex.cpp b/util/stream/hex.cpp index 6d91cbe1cfc..1c05330504a 100644 --- a/util/stream/hex.cpp +++ b/util/stream/hex.cpp @@ -1,30 +1,30 @@ -#include "hex.h" - +#include "hex.h" + #include "output.h" -#include <util/string/hex.h> - +#include <util/string/hex.h> + void HexEncode(const void* in, size_t len, IOutputStream& out) { - static const size_t NUM_OF_BYTES = 32; - char buffer[NUM_OF_BYTES * 2]; - - auto current = static_cast<const char*>(in); - for (size_t take = 0; len; current += take, len -= take) { - take = Min(NUM_OF_BYTES, len); - HexEncode(current, take, buffer); - out.Write(buffer, take * 2); - } -} - + static const size_t NUM_OF_BYTES = 32; + char buffer[NUM_OF_BYTES * 2]; + + auto current = static_cast<const char*>(in); + for (size_t take = 0; len; current += take, len -= take) { + take = Min(NUM_OF_BYTES, len); + HexEncode(current, take, buffer); + out.Write(buffer, take * 2); + } +} + void HexDecode(const void* in, size_t len, IOutputStream& out) { Y_ENSURE(!(len & 1), TStringBuf("Odd buffer length passed to HexDecode")); - - static const size_t NUM_OF_BYTES = 32; - char buffer[NUM_OF_BYTES]; - - auto current = static_cast<const char*>(in); - for (size_t take = 0; len; current += take, len -= take) { - take = Min(NUM_OF_BYTES * 2, len); - HexDecode(current, take, buffer); - out.Write(buffer, take / 2); - } -} + + static const size_t NUM_OF_BYTES = 32; + char buffer[NUM_OF_BYTES]; + + auto current = static_cast<const char*>(in); + for (size_t take = 0; len; current += take, len -= take) { + take = Min(NUM_OF_BYTES * 2, len); + HexDecode(current, take, buffer); + out.Write(buffer, take / 2); + } +} |