not returning the normal hex result, might have '\0'
| 9 | |
| 10 | // not returning the normal hex result, might have '\0' |
| 11 | bool sha1hmac(const char *str, unsigned char out_hash[SHA_DIGEST_LENGTH], const char *secret, |
| 12 | int secret_len) { |
| 13 | if (!str) return false; |
| 14 | |
| 15 | // SHA_DIGEST_LENGTH is 20 |
| 16 | HMAC(EVP_sha1(), secret, secret_len, (unsigned char *)str, strlen(str), out_hash, NULL); |
| 17 | |
| 18 | return true; |
| 19 | } |
| 20 | |
| 21 | bool sha1hmac_hex(const char *str, char out_hash_hex[SHA_DIGEST_STRING_LENGTH], const char *secret, |
| 22 | int secret_len) { |