Bitcoin/public point to address: Difference between revisions
Content deleted Content added
New post. |
m Improved coding. |
||
Line 620:
<syntaxhighlight lang="java">
import java.math.BigInteger;
import java.nio.
import java.util.Arrays;
import java.util.stream.Collectors;
public final class BitcoinPublicPointToAddess {
Line 687 ⟶ 686:
// Convert the hexadecimal string 'text' into a suitable ASCII string for the SHA256 hash
byte[] bytesOne = hexToBytes(text);
String asciiOne =
String hexSHA256 = SHA256.messageDigest(asciiOne);
// Convert the hexadecimal string 'hexSHA256' into a suitable ASCII string for the RIPEMD160 hash
byte[] bytesTwo = hexToBytes(hexSHA256);
String asciiTwo =
String hexRIPEMD160 = RIPEMD160.messageDigest(asciiTwo);
hexRIPEMD160 = BITCOIN_VERSION_NUMBER + hexRIPEMD160;
Line 699 ⟶ 698:
private static byte[] computeChecksum(byte[] bytes) {
// Convert the given byte array into a suitable ASCII string for the first SHA256 hash
String
// Convert the hexadecimal string 'hex1' into a suitable ASCII string for the second SHA256 hash
byte[]
String
String
return Arrays.copyOfRange(hexToBytes(
}
Line 716 ⟶ 715:
}
return bytes;
}
|