 than KDF's based on just a hash function."
   [^bytes keydata ^bytes salt ^bytes info ^Keyword alg]
   (let [params  (HKDFParameters. keydata salt info)
-        digest  (make-digest-instance alg)
+        digest  (hash/resolve-digest alg)
         kdfimpl (HKDFBytesGenerator. digest)]
     (.init kdfimpl params)
     (->HKDF digest kdfimpl)))

(ns buddy.core.kdf
  "Key derivation function interface."
  (:import org.bouncycastle.crypto.generators.KDF2BytesGenerator
           org.bouncycastle.crypto.generators.HKDFBytesGenerator
           org.bouncycastle.crypto.generators.KDFCounterBytesGenerator

           clojure.lang.IFn
           clojure.lang.Keyword))

(defprotocol KDFType
  "Generic type that unify access to any implementation
of kdf implemented in buddy."
  (generate-bytes! [obj length] "Generate bytes"))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; HKDF interface
