public PublicKeyAddress(ImmutableArray <byte> publicKeyBytes) { this.publicKeyBytes = publicKeyBytes; var outputScript1 = new PayToPublicKeyBuilder().CreateOutput(publicKeyBytes.ToArray()); var outputScript2 = new PayToPublicKeyHashBuilder().CreateOutputFromPublicKey(publicKeyBytes.ToArray()); this.outputScript1Hash = new UInt256(SHA256Static.ComputeHash(outputScript1)); this.outputScript2Hash = new UInt256(SHA256Static.ComputeHash(outputScript2)); }
private UInt256 PublicKeyToOutputScriptHash(byte[] publicKey) { if (publicKey.Length != 65) { throw new ArgumentException("publicKey"); } var outputScript = new PayToPublicKeyBuilder().CreateOutput(publicKey); var outputScriptHash = new UInt256(SHA256Static.ComputeHash(outputScript)); return(outputScriptHash); }
private UInt256 PublicKeyToOutputScriptHash(byte[] publicKey) { if (publicKey.Length != 65) { Debugger.Break(); } //Debug.Assert(publicKey.Length == 65); var sha256 = new SHA256Managed(); var outputScript = new PayToPublicKeyBuilder().CreateOutput(publicKey); var outputScriptHash = new UInt256(sha256.ComputeHash(outputScript)); return(outputScriptHash); }