 
 ;; Multihash identifiers have two properties:
 ;;
-;; - `:code` is a numeric code for an algorithm entry in `digest-algorithms` or
-;;   an application-specific algorithm code.
+;; - `:code` is a numeric code for an algorithm entry in `algorithms` or an
+;;   application-specific algorithm code.
 ;; - `:digest` is a string holding the hex-encoded algorithm output.
 (deftype Multihash
   [^long code ^String digest _meta]

  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)))



