I have a better formatted version of my issue here:
http://bitcoin.stackexchange.com/questions/17676/verifying-mrkl-root-from-two-children-nodes-in-javaI 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
temp.append(decimal);
}
return sb.toString();
}
d4 : parse=> Ô
9b : parse=>
95 : parse=>
84 : parse=>
9c : parse=>
87 : parse=>
b8 : parse=> ¸
a4 : parse=> ¤
Why so many blanks? My friend's php implementation (which works) spits out characters for some of those. Although our string lengths are the same size (32), his contains characters that mine doesn't. (this results in the sha256 being different as well)
Some expertise would be appreciated here =/