2 using System.Collections.Generic;
9 /// Representation of pubkey/script hash.
14 const int hashSize = 20;
17 /// Array of digest bytes.
19 private byte[] hashBytes = new byte[hashSize];
22 /// Initializes an empty instance of the Hash160 class.
26 hashBytes = Enumerable.Repeat<byte>(0, hashSize).ToArray();
30 /// Initializes a new instance of Hash160 class with first 20 bytes from supplied list
32 /// <param name="bytesList">List of bytes</param>
33 public Hash160(IList<byte> bytesList)
35 hashBytes = bytesList.Take<byte>(hashSize).ToArray<byte>();
38 public Hash160(byte[] bytesArray)
40 hashBytes = bytesArray;
43 public override string ToString()
45 StringBuilder sb = new StringBuilder(hashSize * 2);
46 foreach (byte b in hashBytes)
48 sb.AppendFormat ("{0:x2}", b);