 
 ;; ## Hash Function Algorithms
 
-(def ^:const digest-algorithms
+(def ^:const algorithms
   "Map of content hashing algorithms to system names and byte encodings."
   {:sha1     {:code 0x11, :length 20, :system "SHA-1"}
    :sha2-256 {:code 0x12, :length 32, :system "SHA-256"}

  Object

  (toString [this]
    (str "hash:" (code->name code) \: digest))

  (equals [this that]
    (cond

  (< 0 code 0x10))


(defn get-algorithm
  "Looks up an algorithm by keyword name or code number. Returns `nil` if the
  value does not map to any valid algorithm."
  [value]
  (cond
    (keyword? value)
    (get algorithms value)

    (not (integer? value))
    nil

    (app-code? value)
    {:code value, :name (keyword (str "app-" value))}

    :else
    (some #(when (= value (:code (val %)))
             (assoc (val %) :name (key %)))
          algorithms)))



