Skip to content

Commit 0f626e5

Browse files
committed
HashCode: Made changes that are necessary for successful compilation
1 parent b1647cc commit 0f626e5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

StandardSocketsHttpHandler/HashCode.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,14 @@ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
4444
using System.Collections.Generic;
4545
using System.ComponentModel;
4646
using System.Runtime.CompilerServices;
47+
using System.Security.Cryptography;
4748

4849
namespace System
4950
{
5051
// xxHash32 is used for the hash code.
5152
// https://github.com/Cyan4973/xxHash
5253

53-
public struct HashCode
54+
internal struct HashCode
5455
{
5556
private static readonly uint s_seed = GenerateGlobalSeed();
5657

@@ -62,8 +63,9 @@ public struct HashCode
6263

6364
private static unsafe uint GenerateGlobalSeed()
6465
{
65-
uint result;
66-
Interop.GetRandomBytes((byte*)&result, sizeof(uint));
66+
byte[] random = new byte[4];
67+
RandomNumberGenerator.Create().GetBytes(random);
68+
uint result = BitConverter.ToUInt32(random, 0);
6769
return result;
6870
}
6971

0 commit comments

Comments
 (0)