git://git.novaco.in
/
NovacoinLibrary.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
990d6bd
)
Hash:GetHashCode()
author
CryptoManiac
<balthazar.ad@gmail.com>
Fri, 28 Aug 2015 14:06:33 +0000 (17:06 +0300)
committer
CryptoManiac
<balthazar.ad@gmail.com>
Fri, 28 Aug 2015 14:06:33 +0000 (17:06 +0300)
Now it's necessary because we want to use hash as key for dictionary.
Novacoin/Hash.cs
patch
|
blob
|
history
diff --git
a/Novacoin/Hash.cs
b/Novacoin/Hash.cs
index
822cadd
..
bbb01bf
100644
(file)
--- 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)