#include "hmac.h" void hmac(uint8_t* msg, uint8_t msglen, uint8_t* secret, uint8_t sec_len){ int8_t i; /* ipad = the byte 0x36 repeated B times opad = the byte 0x5C repeated B times. To compute HMAC over the data `text' we perform H(K XOR opad, H(K XOR ipad, text)) B is length of hash in bytes, K is the secret and "," ist the string concatination operator */ /* inner Hash */ sha1_init(); /*k xor ipad*/ for(i=0;i=0;--i){ sha1_addbyte(hmac_result[i]); } sha1_fill(SHA1_B+SHA1_SIZE); /* save the result */ memcpy(hmac_result,sha1_digest,SHA1_SIZE); }