-
Notifications
You must be signed in to change notification settings - Fork 12
/
HexDumper.hpp
44 lines (34 loc) · 863 Bytes
/
HexDumper.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef _SNARKFRONT_HEX_DUMPER_HPP_
#define _SNARKFRONT_HEX_DUMPER_HPP_
#include <cstdint>
#include <istream>
#include <ostream>
#include <vector>
#include <cryptl/ASCII_Hex.hpp>
#include <cryptl/DataPusher.hpp>
namespace snarkfront {
////////////////////////////////////////////////////////////////////////////////
// print messages in hexdump format
//
class HexDumper
{
public:
HexDumper(std::ostream&);
void print(const std::vector<std::uint8_t>&);
void print(std::istream&);
private:
// print as text characters
class PrintText
{
public:
PrintText(std::ostream&);
void pushOctet(const std::uint8_t);
private:
std::ostream& m_os;
};
cryptl::DataPusher<cryptl::PrintHex<true>> m_hex;
cryptl::DataPusher<PrintText> m_text;
std::ostream& m_os;
};
} // namespace snarkfront
#endif