From 61e5ea4eb585b75ba1925ad4b0322e3da99a78dc Mon Sep 17 00:00:00 2001 From: wanglin90 Date: Fri, 18 Dec 2015 18:28:25 +0800 Subject: [PATCH] Create Base58Check if you want to specify address prefix,use Base58Check.encodeCheckedAndVersion(byte[] input,int verInt). such as specify verInt = 0 then address start with 1. --- .../java/net/bither/bitherj/utils/Base58Check | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 bitherj/src/main/java/net/bither/bitherj/utils/Base58Check diff --git a/bitherj/src/main/java/net/bither/bitherj/utils/Base58Check b/bitherj/src/main/java/net/bither/bitherj/utils/Base58Check new file mode 100644 index 00000000..f022f080 --- /dev/null +++ b/bitherj/src/main/java/net/bither/bitherj/utils/Base58Check @@ -0,0 +1,17 @@ +package net.bither.bitherj.utils; +import net.bither.bitherj.utils.Base58; +import net.bither.bitherj.utils.Utils; +/** + * Created by wanglin on 2015/12/18. + */ +public class Base58Check extends Base58 { + + public static CharSequence encodeCheckedAndVersion(byte[] input ,int verInt){ + + byte[] result = new byte[1+input.length+4]; + result[0]=(byte)verInt; + System.arraycopy(input,0,result,1,input.length); + byte[] check = Utils.doubleDigest(result, 0, (1+input.length)); + System.arraycopy(check,0,result,(1+input.length),4); + return encode(result); + }