           (.doFinal mac buffer 0)
           buffer)))))
 
+(defprotocol IHMac
+  (hash* [data key alg] "Generate the hmac digest for provided data.")
+  (verify* [data signature key alg] "Virify the hmac digest for provided data."))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Low level private function with all logic for make
-;; hmac for distinct types.
+;; Implementation details for different data types.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(defn- make-hmac-for-plain-data
+(defn- hash-plain-data
   [^bytes input key ^Keyword alg]
   (let [engine (hmac-engine key alg)]
     (proto/update! engine input)
     (proto/end! engine)))
 
-(defn- verify-hmac-for-plain-data
+(defn- verify-plain-data
   [^bytes input, ^bytes signature, pkey, ^Keyword alg]
-  (let [sig (make-hmac-for-plain-data input pkey alg)]
+  (let [sig (hash-plain-data input pkey alg)]
     (Arrays/equals sig signature)))
 
-(defn- make-hmac-for-stream
+(defn- hash-stream-data
   [^java.io.InputStream input key ^Keyword alg]
   (let [engine (hmac-engine key alg)
         buffer (byte-array 5120)]


(ns buddy.core.mac.hmac
  "Hash-based Message Authentication Codes (HMACs)"
  (:require [buddy.core.codecs :refer :all]
            [buddy.core.mac.proto :as proto]
            [buddy.core.hash :as hash]

    ;; => true
  "
  [input ^bytes signature key ^Keyword alg]
  (verify* input signature key alg))

(def ^{:doc "Deprecated alias for `hash` function.`"
       :deprecated true}
  hmac hash)
