public PublicKeyHashAddress(ImmutableArray<byte> publicKeyHashBytes) { this.publicKeyHashBytes = publicKeyHashBytes; var outputScript = new PayToPublicKeyHashBuilder().CreateOutputFromPublicKeyHash(publicKeyHashBytes.ToArray()); this.outputScriptHash = new UInt256(SHA256Static.ComputeHash(outputScript)); }
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; }
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; }