Post
Topic
Board Development & Technical Discussion
Re: Problems verifying merkle root from two child nodes
by
danneu
on 03/12/2013, 20:44:50 UTC
Code:
(-> "0d0eb1b4c4b49fd27d100e9cce555d4110594661b1b8ac05a4b8879c84959bd4"
    hex->bytes
    reverse-bytes
    double-sha256
    bytes->hex)

;; "2b9f3fd09cf042ce9eb019b72ac356db63121c1f56ad6af6cbd401bdf0d51f16"

Here're my Java crypto:

Code:
(:import
 [java.security MessageDigest])

(defn sha256 [data]
  (-> (MessageDigest/getInstance "SHA-256" "BC")
      (.digest data)))

(defn double-sha256 [data]
  (sha256 (sha256 data)))

Are you sure you're working with the actual bytes that the hex represents and not, for example, the bytes of the chars that make up the hex string?