   [engine]
   (-end engine))
 
-(defn resolve-digest
+(defn resolve-digest-engine
   "Helper function for make Digest instances
   from algorithm parameter."
-  [alg]
+  {:doc false}
+  [engine]
   (cond
-   (instance? Keyword alg) (let [factory (*available-digests* alg)]
-                             (factory))
-   (instance? Digest alg) alg
-   (instance? IFn alg) (alg)))
+   (instance? Keyword engine)
+   (when-let [factory (get +digest-engines+ engine)]
+     (factory))
+   (instance? Digest engine) engine
+   (instance? IFn engine) (engine)))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Implementation details for different data types.

(defn digest
  "Generic function for create cryptographic hash."
  [input alg-or-engine]
  (let [engine (resolve-digest alg-or-engine)]
    (-digest input engine)))

(defn blake2b

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

(def ^{:doc false}
  +digest-engines+
  {:sha256   #(SHA256Digest.)
   :sha384   #(SHA384Digest.)
   :sha512   #(SHA512Digest.)
