c - Encoding a string in HMAC SHA256 -
how can encode string using hmac sha256 algorithm? went through openssl library didn't find valuable. suggestions?
hmac , sha256 separate components in openssl, you'll need glue them yourself. (note uses shorthand methods doing in 1 shot monolithic buffers; incremental processing more complex.)
#include <openssl/evp.h> #include <openssl/hmac.h> unsigned char* hmac_sha256(const void *key, int keylen, const unsigned char *data, int datalen, unsigned char *result, unsigned int* resultlen) { return hmac(evp_sha256(), key, keylen, data, datalen, result, resultlen); }
even if input string, result arbitrary byte array; if needs string you'll have apply other transformation hexadecimal expansion, base64 or whatever suits application.
Comments
Post a Comment