Kea 2.7.5
isc::util::encode::Base16Encoder Class Reference

Class for encoding and decoding binary data using Base16 (aka Hex) as described in RFC 4648. More...

#include <encode.h>

+ Inheritance diagram for isc::util::encode::Base16Encoder:

Public Member Functions

 Base16Encoder ()
 Constructor.
 
 ~Base16Encoder ()=default
 Destructor.
 
- Public Member Functions inherited from isc::util::encode::BaseNEncoder
 BaseNEncoder (const std::string &algorithm, const char *digit_set, const std::vector< uint8_t > &bits_table, size_t bits_per_digit, size_t digits_per_group, const char pad_char, size_t max_pad, bool case_sensitive)
 Constructor.
 
virtual ~BaseNEncoder ()=default
 Destructor.
 
char bitsToDigit (uint8_t bits)
 Translate a byte of binary data into the appropriate algorithm digit.
 
void decode (const std::string &encoded_str, std::vector< uint8_t > &output)
 Decodes an encoded string using the encoder's algorithm.
 
uint8_t digitToBits (uint8_t digit)
 Translate a digit into the appropriate algorithm bit value.
 
std::string encode (const std::vector< uint8_t > &input)
 Encodes binary data using the encoder's algorithm.
 
std::string getAlgorithm () const
 Get the algorithm name.
 
size_t getBitsPerDigit ()
 Get the number of data bits represented by a digit.
 
const std::vector< uint8_t > & getBitsTable () const
 Get the digit lookup table.
 
const char * getDigitSet () const
 Get the digit set.
 
size_t getDigitsPerGroup () const
 Get the number of digits contained in a group.
 
size_t getMaxBitsToDigit ()
 Get the maxium index value of the digit set.
 
size_t getMaxDigitToBits ()
 Get the maxium index value of the algorithm bit table.
 
size_t getMaxPad ()
 Get the maximum number of pad characters in a group.
 
uint8_t getPadChar () const
 Get the character used for padding out to group size (0 means no padding)
 
bool isCaseSensitive ()
 Indicates whether or not the algorithm's digit set is case-sensitive.
 

Static Public Attributes

static const std::vector< uint8_t > BITS_TABLE
 Table that maps Base16 digits to their binary data value.
 
static const char * DIGIT_SET = "0123456789ABCDEF"
 Set of digits used for encoding in Base16.
 

Additional Inherited Members

- Protected Attributes inherited from isc::util::encode::BaseNEncoder
std::string algorithm_
 Name of the algorithm, used for logging.
 
size_t bits_per_digit_
 Number of data bits represented by a digit.
 
std::vector< uint8_t > bits_table_
 Table to translate digits to data used during decoding.
 
bool case_sensitive_
 Indicates whether or not the algorithm's digit set is case-sensitive.
 
const char * digit_set_
 Set of digits (i.e. alphabet) used for encoding.
 
size_t digits_per_group_
 Number of digits contained in a group.
 
size_t max_bits_to_digit_
 Maxium index value of the digit set.
 
size_t max_digit_to_bits_
 Maxium index value of the algorithm bit table.
 
size_t max_pad_
 Maximum number of pad characters in a group.
 
const char pad_char_
 Character used for padding out to group size (0 means no padding)
 

Detailed Description

Class for encoding and decoding binary data using Base16 (aka Hex) as described in RFC 4648.

Definition at line 229 of file encode.h.

Constructor & Destructor Documentation

◆ Base16Encoder()

isc::util::encode::Base16Encoder::Base16Encoder ( )
inline

Constructor.

Definition at line 238 of file encode.h.

◆ ~Base16Encoder()

isc::util::encode::Base16Encoder::~Base16Encoder ( )
default

Destructor.

Member Data Documentation

◆ BITS_TABLE

const std::vector< uint8_t > isc::util::encode::Base16Encoder::BITS_TABLE
static
Initial value:
= {
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xee,0xee,0xee,0xee,0xee,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xee,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,10,11,12,13,14,15,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,10,11,12,13,14,15,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
}

Table that maps Base16 digits to their binary data value.

Definition at line 235 of file encode.h.

◆ DIGIT_SET

const char * isc::util::encode::Base16Encoder::DIGIT_SET = "0123456789ABCDEF"
static

Set of digits used for encoding in Base16.

Definition at line 232 of file encode.h.


The documentation for this class was generated from the following files: