#pragma once #include #include #include #include namespace rublon { // +1 for \0 inline std::array< char, 64 + 1 > signData(std::string_view data, std::string_view secretKey) { std::array< char, 64 + 1 > xRublon; std::array< unsigned char, EVP_MAX_MD_SIZE > md; unsigned int md_len{}; HMAC(EVP_sha256(), secretKey.data(), secretKey.size(), ( unsigned const char * ) data.data(), data.size(), md.data(), &md_len); for(unsigned int i = 0; i < md_len; i++) sprintf(&xRublon[i * 2], "%02x", ( unsigned int ) md[i]); return xRublon; } } // namespace rublon