コード例 #1
0
        public PublicKeyHashAddress(ImmutableArray <byte> publicKeyHashBytes)
        {
            this.publicKeyHashBytes = publicKeyHashBytes;

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

            this.outputScriptHash = new UInt256(SHA256Static.ComputeHash(outputScript));
        }
コード例 #2
0
ファイル: Top10000Address.cs プロジェクト: xia7410/BitSharp
        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);
        }
コード例 #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);
        }
コード例 #4
0
ファイル: PublicKeyAddress.cs プロジェクト: xia7410/BitSharp
        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));
        }
コード例 #5
0
        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);
        }
コード例 #6
0
ファイル: First10000Address.cs プロジェクト: xia7410/BitSharp
        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);
        }