 ; TODO: encode
 ; TODO: decode
 
-(defn- zero-pad
-  "Pads a string with leading zeroes up to the given width."
-  [width value]
-  (let [string (str value)]
-    (if (<= width (count string))
-      string
-      (-> width
-          (- (count string))
-          (repeat "0")
-          str/join
-          (str string)))))
 
-
-(defn hex-str
-  "Converts a byte array into a lowercase hexadecimal string."
-  [^bytes value]
-  (let [width (* 2 (count value))
-        hex (-> (BigInteger. 1 value)
-                (.toString 16)
-                str/lower-case)]
-    (zero-pad width hex)))
-
-
+; TODO: multimethod?
 (defn hash
   "Calculates the digest of the given byte array and returns a `Multihash`."
   [algorithm ^bytes content]

    (cond
      (identical? this that) true
      (instance? Multihash that)
        (and (= code (:code that))
             (= digest (:digest that)))
      :else false))

  (hashCode [this]

      :algorithm (code->name code)
      :length (/ (count digest) 2)
      :digest digest
      :bytes (hex->bytes digest)
      not-found))

  (valAt [this k]
