Exemplo n.º 1
0
        /// <exception cref="AddressFormatException"/>
        protected VersionedChecksummedBytes(string encoded)
        {
            var tmp = Base58Helper.DecodeChecked(encoded);

            Version = tmp[0];
            Bytes   = new byte[tmp.Length - 1];
            Array.Copy(tmp, 1, Bytes, 0, tmp.Length - 1);
        }
Exemplo n.º 2
0
        private static byte[] GetBytesFromBase58Key(string privateKey)
        {
            var tmp   = Base58Helper.DecodeWithCheckSum(privateKey);
            var bytes = new byte[tmp.Length - 1];

            Array.Copy(tmp, 1, bytes, 0, tmp.Length - 1);

            return(bytes);
        }
Exemplo n.º 3
0
        public override string ToString()
        {
            // A stringified buffer is:
            //   1 byte version + data bytes hash + 4 bytes check code (itself a truncated hash)
            var addressBytes = new byte[1 + Bytes.Length + 4];

            addressBytes[0] = (byte)Version;
            Array.Copy(Bytes, 0, addressBytes, 1, Bytes.Length);
            var check = Utils.DoubleDigest(addressBytes, 0, Bytes.Length + 1);

            Array.Copy(check, 0, addressBytes, Bytes.Length + 1, 4);
            return(Base58Helper.Encode(addressBytes));
        }