Skip to content

Commit

Permalink
Added linux compatibility for hardware random number generator
Browse files Browse the repository at this point in the history
  • Loading branch information
Xeroxxx committed Feb 3, 2017
1 parent 6b36711 commit 044c079
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ServUO.MONO.exe.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@
<gcServer enabled="true" />
</runtime>
<dllmap dll="libz" target="libz.so.1" />
<dllmap dll="drng32" target="libdrng.so" />
<dllmap dll="drng64" target="libdrng.so" />
</configuration>
10 changes: 9 additions & 1 deletion Server/Random.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ public static class RandomImpl

static RandomImpl()
{
if (Core.Unix)
if (Core.Unix && Core.Is64Bit && File.Exists("libdrng.so"))
{
_Random = new RDRand64();
}
else if (Core.Unix && File.Exists("libdrng.so"))
{
_Random = new RDRand32();
}
else if (Core.Unix)
{
_Random = new SimpleRandom();
}
Expand Down

0 comments on commit 044c079

Please sign in to comment.