ledger-core
|
Functions | |
std::vector< uint8_t > | toByteArray (const std::string &str) |
std::string | toString (const std::vector< uint8_t > &data) |
uint8_t | digitToByte (char c) |
std::string | toString (const std::vector< uint8_t > &data, bool uppercase) |
char | byteToDigit (uint8_t byte, bool uppercase) |
Utility functions to deal with hexadecimal encoded string.
|
inline |
Turns a single byte (the byte must be lower than 0x10) into a digit.
std::invalid_argument | When encountering an invalid character. |
|
inline |
Turns a single digit into its byte value.
c |
std::vector< uint8_t > ledger::core::hex::toByteArray | ( | const std::string & | hexString | ) |
Decodes the given string into a byte array.
hexString | A string of bytes expressed in hexadecimal (e.g. "A0B1"). |
std::invalid_argument | When encountering an invalid character. |
std::string ledger::core::hex::toString | ( | const std::vector< uint8_t > & | data | ) |
Encodes the given byte array into an hexadecimal string (lowercase).
data |
std::string ledger::core::hex::toString | ( | const std::vector< uint8_t > & | data, |
bool | uppercase | ||
) |
Encodes the given byte array into an hexadecimal string.
data | A byte array |
uppercase | True if the output should be expressed in uppercase characters, false otherwise |