BitSharper.Utils.Sha256Hash160 C# (CSharp) 메소드

Sha256Hash160() 공개 정적인 메소드

Calculates RIPEMD160(SHA256(input)). This is used in Address calculations.
public static Sha256Hash160 ( byte input ) : byte[]
input byte
리턴 byte[]
        public static byte[] Sha256Hash160(byte[] input)
        {
            var sha256 = new SHA256Managed().ComputeHash(input);
            var digest = new RipeMD160Digest();
            digest.BlockUpdate(sha256, 0, sha256.Length);
            var @out = new byte[20];
            digest.DoFinal(@out, 0);
            return @out;
        }

Usage Example

예제 #1
0
        /// <summary>
        /// Returns the address that corresponds to the public part of this ECKey. Note that an address is derived from
        /// the RIPEMD-160 hash of the public key and is not the public key itself (which is too large to be convenient).
        /// </summary>
        public Address ToAddress(NetworkParameters @params)
        {
            var hash160 = Utils.Sha256Hash160(_pub);

            return(new Address(@params, hash160));
        }