@@ -52,8 +52,11 @@ namespace hmac_cpp {
5252 }
5353
5454 // / \brief Streaming HMAC computation context.
55+ // / \thread_safety Not thread-safe.
5556 class HMAC_CPP_API HmacContext {
5657 public:
58+ // / \brief Construct context for selected hash.
59+ // / \param type Hash function type.
5760 explicit HmacContext (TypeHash type) : type_(type), block_size_(0 ), digest_size_(0 ) {}
5861
5962 // / \brief Initializes the context with a secret key.
@@ -114,17 +117,31 @@ namespace hmac_cpp {
114117 // / \return HMAC result
115118 HMAC_CPP_API std::string get_hmac (const std::vector<uint8_t >& key, const std::string &msg, TypeHash type, bool is_hex = true , bool is_upper = false );
116119
117- // / \brief Computes HMAC from secure_buffer key
120+ // / \brief Compute HMAC using secure_buffer key.
121+ // / \param key Secret key bytes.
122+ // / \param msg Message to authenticate.
123+ // / \param type Hash function type.
124+ // / \param is_hex Return result in hex format.
125+ // / \param is_upper Use uppercase hex.
126+ // / \return HMAC result.
118127 inline std::string get_hmac (const secure_buffer<uint8_t >& key, const std::string &msg, TypeHash type, bool is_hex = true , bool is_upper = false ) {
119128 return get_hmac (std::vector<uint8_t >(key.begin (), key.end ()), msg, type, is_hex, is_upper);
120129 }
121130
131+ // / \brief Compute HMAC using string key.
132+ // / \param key_input Secret key as string.
133+ // / \param msg Message to authenticate.
134+ // / \param type Hash function type.
135+ // / \param is_hex Return result in hex format.
136+ // / \param is_upper Use uppercase hex.
137+ // / \return HMAC result.
122138 // / \deprecated Prefer overloads that accept std::vector<uint8_t> or secure_buffer.
123139 HMACCPP_DEPRECATED (" use std::vector<uint8_t> or secure_buffer overload" )
124140 inline std::string get_hmac (const std::string& key_input, const std::string &msg, TypeHash type, bool is_hex = true , bool is_upper = false ) {
125141 return get_hmac (std::vector<uint8_t >(key_input.begin (), key_input.end ()), msg, type, is_hex, is_upper);
126142 }
127143}
144+
128145namespace hmac = hmac_cpp;
129146
130147#endif // _HMAC_HPP_INCLUDED
0 commit comments