12#include <botan/internal/fmt.h>
19 rng.
randomize(m_uuid.data(), m_uuid.size());
22 m_uuid[6] = 0x40 | (m_uuid[6] & 0x0F);
25 m_uuid[8] = 0x80 | (m_uuid[8] & 0x3F);
29 if(blob.size() != 16) {
37 if(uuid_str.size() != 36 || uuid_str[8] !=
'-' || uuid_str[13] !=
'-' || uuid_str[18] !=
'-' ||
38 uuid_str[23] !=
'-') {
43 for(
char c : uuid_str) {
53 if(m_uuid.size() != 16) {
60 throw Invalid_State(
"UUID object is empty cannot convert to string");
65 std::ostringstream formatted;
67 for(
size_t i = 0; i != raw.size(); ++i) {
68 if(i == 8 || i == 12 || i == 16 || i == 20) {
74 return formatted.str();
void randomize(std::span< uint8_t > output)
std::string to_string() const
std::string fmt(std::string_view format, const T &... args)
void hex_encode(char output[], const uint8_t input[], size_t input_length, bool uppercase)
size_t hex_decode(uint8_t output[], const char input[], size_t input_length, size_t &input_consumed, bool ignore_ws)