From 4ef09413d32577c9c5aa67f790e3f7c7b21cbb00 Mon Sep 17 00:00:00 2001 From: CryptoManiac Date: Fri, 28 Aug 2015 17:06:33 +0300 Subject: [PATCH] Hash:GetHashCode() Now it's necessary because we want to use hash as key for dictionary. --- Novacoin/Hash.cs | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Novacoin/Hash.cs b/Novacoin/Hash.cs index 822cadd..bbb01bf 100644 --- a/Novacoin/Hash.cs +++ b/Novacoin/Hash.cs @@ -94,8 +94,15 @@ namespace Novacoin public override int GetHashCode() { - // It's a hash already, so any idea of trying to get its hashcode doesn't make any sense to me - throw new NotSupportedException(); + int hash = 17; + unchecked + { + foreach (var element in _hashBytes) + { + hash = hash * 31 + element.GetHashCode(); + } + } + return hash; } public int CompareTo(Hash item) -- 1.7.1