Init some fields, add ToString() for Hash160 and Hash256, start implementation of...
[NovacoinLibrary.git] / Novacoin / Hash256.cs
index 655b300..365f778 100644 (file)
@@ -1,4 +1,6 @@
 \feffusing System;
+using System.Text;
+using System.Linq;
 
 namespace Novacoin
 {
@@ -12,8 +14,22 @@ namespace Novacoin
                /// </summary>
                private byte[] h;
 
+               /// <summary>
+               /// Initializes an empty instance of the Hash256 class.
+               /// </summary>
                public Hash256 ()
                {
+                       h = Enumerable.Repeat<byte>(0, 32).ToArray();
+               }
+
+               public override string ToString()
+               {
+                       StringBuilder sb = new StringBuilder(h.Length * 2);
+                       foreach (byte b in h)
+                       {
+                               sb.AppendFormat ("{0:x2}", b);
+                       }
+                       return sb.ToString();
                }
        }
 }