If I get this right, you want to compute a MAC (specifically HMAC-SHA256) of a file using a given key.
(I hope the key you posted here is only a "demo" key!)
The C/C++ standard library does not
contain such highly specific crypto functions. So, you'll either have to code it all
yourself, or you have to use a suitable third-party
library. But, unless this is for your own education, you certainly do not
want to implement crypto functions yourself! Not only because it would be a whole lot of work to implement it all yourself, but also because it is way
to easy to shoot yourself in the foot!
(Most "homebrew" crypto code is insecure
for one reason or another)
Therefore, it is highly
recommended to use an existing crypto library. Since OpenSSL in fact consists of two C libraries (libcrypto
) plus a command-line application that uses these libraries, you can simply write your own C/C++ application that calls the relevant functions from libcrypto
(OpenSSL crypto library).
API documentation on OpenSSL web-site for details:
Specifically for HMAC see:
(Warning: OpenSSL API documentation is often confusing and/or incomplete, in my experience, so if you are not used to calling third-party libraries from your own C/C++ code, this will be a rough start)