(ws) add subcommands: cobra subscribe, and cobra subscribe to statsd bridge

This commit is contained in:
Benjamin Sergeant
2019-04-08 21:52:20 -07:00
parent 56b19fa2b0
commit 51fcf65424
28 changed files with 1008 additions and 8246 deletions

View File

@ -6,7 +6,11 @@
#include "IXHMac.h"
#include "IXBase64.h"
#include <openssl/hmac.h>
#ifdef __APPLE__
# include <CommonCrypto/CommonHMAC.h>
#else
# include <openssl/hmac.h>
#endif
namespace ix
{
@ -15,10 +19,17 @@ namespace ix
constexpr size_t hashSize = 16;
unsigned char hash[hashSize];
#ifdef __APPLE__
CCHmac(kCCHmacAlgMD5,
key.c_str(), key.size(),
data.c_str(), data.size(),
&hash);
#else
HMAC(EVP_md5(),
key.c_str(), (int) key.size(),
(unsigned char *) data.c_str(), (int) data.size(),
(unsigned char *) hash, nullptr);
#endif
std::string hashString(reinterpret_cast<char*>(hash), hashSize);