Skip to content

Instantly share code, notes, and snippets.

@chromabox
Created July 4, 2014 08:48
Show Gist options
  • Save chromabox/ea981743e159ee1827bb to your computer and use it in GitHub Desktop.
Save chromabox/ea981743e159ee1827bb to your computer and use it in GitHub Desktop.
[C++]HMACをC++で書いてみた ref: http://qiita.com/chromabox/items/f22cba135a055f9c6cbf
#include "hmac.hpp"
void test()
{
using namespace std;
string digest;
string key("keykey");
string data("abcdefg");
hmac_sha1::create_digest(data.c_str(),data.size(),key.c_str(),key.size(),digest);
cout << digest << endl;
}
#include "sha1.hpp"
void test()
{
using namespace std;
sha1 hasher;
string digest;
string data("abcdefg");
hasher.update(data.c_str(),data.size());
hasher.final(digest);
cout << digest << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment