2 #include <samchon/API.hpp> 6 #include <boost/uuid/sha1.hpp> 8 #include <samchon/ByteArray.hpp> 9 #include <samchon/library/Base64.hpp> 10 #include <samchon/library/Date.hpp> 19 enum OpCode :
unsigned char 26 enum SizeCode :
unsigned char 32 static const unsigned char MASK = 128;
34 static auto GUID() -> std::string
36 return "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
39 static auto generate_base64_certification_key() -> std::string
41 static std::uniform_int_distribution<unsigned short> distribution(0, 255);
42 static std::random_device device;
44 std::string certification_key(16, NULL);
45 for (
size_t i = 0; i < certification_key.size(); i++)
46 certification_key[i] = (
unsigned char)distribution(device);
49 byte_array.assign(certification_key.begin(), certification_key.end());
54 static auto encode_certification_key(
const std::string &base64) -> std::string
56 std::string acceptKey = base64 + GUID();
58 boost::uuids::detail::sha1 hash;
59 hash.process_bytes(acceptKey.c_str(), acceptKey.size());
62 unsigned int digest[5];
63 hash.get_digest(digest);
65 for (
size_t index = 0; index < 5; index++)
66 bytes.writeReversely(digest[index]);
static auto encode(const Container &byte_array) -> std::string
Encode from binary data to base64-string.