Skip to content

Commit 0e83c87

Browse files
committed
Revert "Update Murmur3 to use cryptographically secure seed"
This reverts commit d4ce8f4. The problem is that this destabilizes hash computes for the case macro. Need to revisit this while providing a way to provide stable hashes for case.
1 parent 4c04876 commit 0e83c87

1 file changed

Lines changed: 1 addition & 14 deletions

File tree

Clojure/Clojure/Lib/Murmur3.cs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
using System.Collections;
1717
using System.Collections.Generic;
1818
using System.Linq;
19-
using System.Security.Cryptography;
2019
using System.Text;
2120

2221
namespace clojure.lang
@@ -38,7 +37,7 @@ public static class Murmur3
3837
{
3938
#region Data
4039

41-
static readonly uint Seed = GenerateSeed();
40+
const int Seed = 0;
4241
const uint C1 = 0xcc9e2d51;
4342
const uint C2 = 0x1b873593;
4443
const int R1 = 15;
@@ -221,18 +220,6 @@ private static uint RotateLeft(uint x, int n)
221220
{
222221
return (x << n) | (x >> (32 - n));
223222
}
224-
225-
private static uint GenerateSeed()
226-
{
227-
#if NET6_0_OR_GREATER
228-
return unchecked((uint)RandomNumberGenerator.GetInt32(int.MinValue, int.MaxValue));
229-
#else
230-
byte[] bytes = new byte[4];
231-
using (var rng = RandomNumberGenerator.Create())
232-
rng.GetBytes(bytes);
233-
return BitConverter.ToUInt32(bytes, 0);
234-
#endif
235-
}
236223
#endregion
237224
}
238225
}

0 commit comments

Comments
 (0)