@Test public void testDecodeChecked() { Base58.decodeChecked("4stwEBjT6FYyVV"); Base58.decodeChecked("93VYUMzRG9DdbRP72uQXjaWibbQwygnvaCu9DumcqDjGybD864T"); }
public static byte[] decodeChecked(String input) throws AddressFormatException { byte[] decoded = decode(input); if (decoded.length < 4) throw new AddressFormatException.InvalidDataLength("Input too short: " + decoded.length); byte[] data = Arrays.copyOfRange(decoded, 0, decoded.length - 4); byte[] checksum = Arrays.copyOfRange(decoded, decoded.length - 4, decoded.length); byte[] actualChecksum = Arrays.copyOfRange(Sha256Hash.hashTwice(data), 0, 4); if (!Arrays.equals(checksum, actualChecksum)) throw new AddressFormatException.InvalidChecksum(); return data; }
Base58 { public static byte[] decodeChecked(String input) throws AddressFormatException { byte[] decoded = decode(input); if (decoded.length < 4) throw new AddressFormatException.InvalidDataLength("Input too short: " + decoded.length); byte[] data = Arrays.copyOfRange(decoded, 0, decoded.length - 4); byte[] checksum = Arrays.copyOfRange(decoded, decoded.length - 4, decoded.length); byte[] actualChecksum = Arrays.copyOfRange(Sha256Hash.hashTwice(data), 0, 4); if (!Arrays.equals(checksum, actualChecksum)) throw new AddressFormatException.InvalidChecksum(); return data; } }
Base58 { public static byte[] decodeChecked(String input) throws AddressFormatException { byte[] decoded = decode(input); if (decoded.length < 4) throw new AddressFormatException.InvalidDataLength("Input too short: " + decoded.length); byte[] data = Arrays.copyOfRange(decoded, 0, decoded.length - 4); byte[] checksum = Arrays.copyOfRange(decoded, decoded.length - 4, decoded.length); byte[] actualChecksum = Arrays.copyOfRange(Sha256Hash.hashTwice(data), 0, 4); if (!Arrays.equals(checksum, actualChecksum)) throw new AddressFormatException.InvalidChecksum(); return data; }  }
Base58 { public static byte[] decodeChecked(String input) throws AddressFormatException { byte[] decoded = decode(input); if (decoded.length < 4) throw new AddressFormatException.InvalidDataLength("Input too short: " + decoded.length); byte[] data = Arrays.copyOfRange(decoded, 0, decoded.length - 4); byte[] checksum = Arrays.copyOfRange(decoded, decoded.length - 4, decoded.length); byte[] actualChecksum = Arrays.copyOfRange(Sha256Hash.hashTwice(data), 0, 4); if (!Arrays.equals(checksum, actualChecksum)) throw new AddressFormatException.InvalidChecksum(); return data; }  static String encode(byte[] input); static String encodeChecked(int version, byte[] payload); static byte[] decode(String input); static BigInteger decodeToBigInteger(String input); static byte[] decodeChecked(String input); }
Base58 { public static byte[] decodeChecked(String input) throws AddressFormatException { byte[] decoded = decode(input); if (decoded.length < 4) throw new AddressFormatException.InvalidDataLength("Input too short: " + decoded.length); byte[] data = Arrays.copyOfRange(decoded, 0, decoded.length - 4); byte[] checksum = Arrays.copyOfRange(decoded, decoded.length - 4, decoded.length); byte[] actualChecksum = Arrays.copyOfRange(Sha256Hash.hashTwice(data), 0, 4); if (!Arrays.equals(checksum, actualChecksum)) throw new AddressFormatException.InvalidChecksum(); return data; }  static String encode(byte[] input); static String encodeChecked(int version, byte[] payload); static byte[] decode(String input); static BigInteger decodeToBigInteger(String input); static byte[] decodeChecked(String input); static final char[] ALPHABET; }