Ejemplo n.º 1
0
        public static String FromByteArray(Byte[] b, Byte version)
        {
            SHA256 sha256 = SHA256.Create();

            b = (new Byte[] { version }).Concat(b).ToArray();
            Byte[] hash = sha256.ComputeHash(sha256.ComputeHash(b)).Take(4).ToArray();
            return(Base58String.FromByteArray(b.Concat(hash).ToArray()));
        }
Ejemplo n.º 2
0
        public string ExtendedPrivateKeyString(string format)
        {

            SHA256 sha = SHA256.Create();

            if (format == null || format == "base58")
            {
                byte[] hash = sha.ComputeHash(sha.ComputeHash(this.extended_private_key));
                byte[] checksum = hash.Take(4).ToArray();
                byte[] data = this.extended_private_key.Concat(checksum).ToArray();

                return Base58String.FromByteArray(data);

            }
            else if (format == "hex")
            {
                return HexString.FromByteArray(this.extended_private_key);
            }
            else
            {
                throw new Exception("bad format");
            }
        }