Beispiel #1
0
        public PublicKeyHashAddress(ImmutableArray <byte> publicKeyHashBytes)
        {
            this.publicKeyHashBytes = publicKeyHashBytes;

            var outputScript = new PayToPublicKeyHashBuilder().CreateOutputFromPublicKeyHash(publicKeyHashBytes.ToArray());

            this.outputScriptHash = new UInt256(SHA256Static.ComputeHash(outputScript));
        }
Beispiel #2
0
        private UInt256 AddressToOutputScriptHash(string address)
        {
            var sha256           = new SHA256Managed();
            var publicKeyHash    = Base58Encoding.DecodeWithCheckSum(address);
            var outputScript     = new PayToPublicKeyHashBuilder().CreateOutputFromPublicKeyHash(publicKeyHash);
            var outputScriptHash = new UInt256(sha256.ComputeHash(outputScript));

            return(outputScriptHash);
        }
Beispiel #3
0
        private UInt256 AddressToOutputScriptHash(string address)
        {
            var addressBytes  = Base58Encoding.DecodeWithCheckSum(address);
            var publicKeyHash = addressBytes.Skip(1).ToArray();

            var outputScript     = new PayToPublicKeyHashBuilder().CreateOutputFromPublicKeyHash(publicKeyHash);
            var outputScriptHash = new UInt256(SHA256Static.ComputeHash(outputScript));

            return(outputScriptHash);
        }
Beispiel #4
0
        public PublicKeyAddress(ImmutableArray <byte> publicKeyBytes)
        {
            this.publicKeyBytes = publicKeyBytes;

            var sha256        = new SHA256Managed();
            var outputScript1 = new PayToPublicKeyBuilder().CreateOutput(publicKeyBytes.ToArray());
            var outputScript2 = new PayToPublicKeyHashBuilder().CreateOutputFromPublicKey(publicKeyBytes.ToArray());

            this.outputScript1Hash = new UInt256(sha256.ComputeHash(outputScript1));
            this.outputScript2Hash = new UInt256(sha256.ComputeHash(outputScript2));
        }
        private UInt256 PublicKeyHashToOutputScriptHash(byte[] publicKeyHash)
        {
            if (publicKeyHash.Length != 20)
            {
                throw new ArgumentException("publicKeyHash");
            }

            var outputScript     = new PayToPublicKeyHashBuilder().CreateOutputFromPublicKeyHash(publicKeyHash);
            var outputScriptHash = new UInt256(SHA256Static.ComputeHash(outputScript));

            return(outputScriptHash);
        }
Beispiel #6
0
        private UInt256 PublicKeyHashToOutputScriptHash(byte[] publicKeyHash)
        {
            if (publicKeyHash.Length != 20)
            {
                Debugger.Break();
            }
            //Debug.Assert(publicKeyHash.Length == 20);

            var sha256           = new SHA256Managed();
            var outputScript     = new PayToPublicKeyHashBuilder().CreateOutputFromPublicKeyHash(publicKeyHash);
            var outputScriptHash = new UInt256(sha256.ComputeHash(outputScript));

            return(outputScriptHash);
        }