Skip to content

Commit 280dee1

Browse files
committed
remove the hard code hash code
remove the hard code hash code
1 parent 9479fe2 commit 280dee1

2 files changed

Lines changed: 2 additions & 36 deletions

File tree

src/OutputCacheModuleAsync/CachedVary.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public override bool Equals(object obj) {
2525
&& StringUtil.StringArrayEquals(Params, cv.Params);
2626
}
2727

28+
/*
2829
public override int GetHashCode() {
2930
var hashCodeCombiner = new HashCodeCombiner();
3031
hashCodeCombiner.AddObject(VaryByAllParams);
@@ -34,5 +35,6 @@ public override int GetHashCode() {
3435
hashCodeCombiner.AddArray(Params);
3536
return hashCodeCombiner.CombinedHash32;
3637
}
38+
*/
3739
}
3840
}

src/OutputCacheModuleAsync/Util.cs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -193,42 +193,6 @@ internal static DateTime UtcParse(string time) {
193193
}
194194
}
195195

196-
internal class HashCodeCombiner {
197-
private long _combinedHash;
198-
199-
public HashCodeCombiner() {
200-
// Start with a seed (obtained from string.GetHashCode implementation)
201-
_combinedHash = 5381;
202-
}
203-
204-
public void AddArray(string[] a) {
205-
if (a == null) {
206-
return;
207-
}
208-
int n = a.Length;
209-
for (int i = 0; i < n; i++) {
210-
AddObject(a[i]);
211-
}
212-
}
213-
214-
public void AddInt(int n) {
215-
_combinedHash = ((_combinedHash << 5) + _combinedHash) ^ n;
216-
Debug.WriteLine("HashCodeCombiner", "Adding " + n.ToString("x") + " --> " + _combinedHash.ToString("x"));
217-
}
218-
219-
public void AddObject(string s) {
220-
if (s != null)
221-
AddInt(s.GetHashCode());
222-
}
223-
224-
public void AddObject(object o) {
225-
if (o != null)
226-
AddInt(o.GetHashCode());
227-
}
228-
229-
public int CombinedHash32 => _combinedHash.GetHashCode();
230-
}
231-
232196
internal class StringUtil {
233197
public static bool StringArrayEquals(string[] a, string[] b) {
234198
if ((a == null) != (b == null)) {

0 commit comments

Comments
 (0)