I am having issues with verifying the mrkl_root with the two children nodes.
Let's use the following block for a reference:
http://blockexplorer.com/rawblock/00000000000000001e8d6829a8a21adc5d38d0a473b144b6765798e61f98bd1dAccording to my understanding (correct if wrong), I need to perform a byteSwap on each child, perform a hexToAscii, concatenate, then perform a double sha256. I am doing this in JAVA, an suspect that my hexToAscii method is off. I was hoping I could give some results to see if someone can verify where the problem is.
String childNode = "0d0eb1b4c4b49fd27d100e9cce555d4110594661b1b8ac05a4b8879c84959bd4";
byteSwap(childNode); //d49b95849c87b8a405acb8b161465910415d55ce9c0e107dd29fb4c4b4b10e0d
hexToAscii(byteSwap(childNode)); //Ô¸¤¬¸±aFYA]UÎ}Ò´Ä´±
And just to verify that my hexToAscii result is correct, can someone check the sha256 hash of the result? I feel that there are encoding issues with my implementation
sha256(hexToAscii(byteSwap(childNode)));
//e799dc13aaeaa1c2797596f5d4bf6c408b97a8595bf32c27c9186125454560d9
Would appreciate any advice if something seems off! Thanks!
I am convinced that there is a JAVA issue with my hexToAscii implementation.
public String hexToBin(String hex) {
StringBuilder sb = new StringBuilder();
StringBuilder temp = new StringBuilder();
//49204c6f7665204a617661 split into two characters 49, 20, 4c...
for(int i = 0; i < hex.length() - 1; i += 2){
//grab the hex in pairs
String output = hex.substring(i, (i + 2));
//convert hex to decimal
int decimal = Integer.parseInt(output, 16);
//convert the decimal to character
sb.append((char)decimal);
temp.append(decimal);
}
return sb.toString();
}
Some expertise would be appreciated here =/ Thanks