2 using System.Security.Cryptography;
3 using System.Collections.Generic;
10 /// Representation of pubkey/script hash.
12 public class Hash160 : Hash
15 /// Computes RIPEMD160 hash using managed library
17 private static readonly RIPEMD160Managed _hasher160 = new RIPEMD160Managed();
20 public override int hashSize
25 public Hash160() : base() { }
26 public Hash160(byte[] bytes) : base(bytes) { }
27 public Hash160(IEnumerable<byte> bytes) : base(bytes) { }
29 public static Hash160 Compute160(IEnumerable<byte> inputBytes)
31 byte[] dataBytes = inputBytes.ToArray();
32 byte[] digest1 = _hasher256.ComputeHash(dataBytes, 0, dataBytes.Length);
33 byte[] digest2 = _hasher160.ComputeHash(digest1, 0, digest1.Length);
35 return new Hash160(digest2);