mirror of
https://github.com/BepInEx/BepInEx.git
synced 2026-10-20 01:46:13 +00:00
Add crypto entrypoint
This commit is contained in:
2 files changed
+35
No files matched your search
@@ -28,6 +28,7 @@
|
||||
<Compile Include="Entrypoint.cs" />
|
||||
<Compile Include="Linker.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RngEntrypoint.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BepInEx\BepInEx.csproj">
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace BepInEx.Bootstrap
|
||||
{
|
||||
[ComVisible(true)]
|
||||
public class RngEntrypoint : RandomNumberGenerator
|
||||
{
|
||||
private RNGCryptoServiceProvider InternalProvider { get; }
|
||||
|
||||
static RngEntrypoint()
|
||||
{
|
||||
Entrypoint.Init();
|
||||
}
|
||||
|
||||
public RngEntrypoint()
|
||||
=> InternalProvider = new RNGCryptoServiceProvider();
|
||||
|
||||
public RngEntrypoint(string str)
|
||||
=> InternalProvider = new RNGCryptoServiceProvider(str);
|
||||
|
||||
public RngEntrypoint(byte[] rgb)
|
||||
=> InternalProvider = new RNGCryptoServiceProvider(rgb);
|
||||
|
||||
public RngEntrypoint(CspParameters cspParams)
|
||||
=> InternalProvider = new RNGCryptoServiceProvider(cspParams);
|
||||
|
||||
public override void GetBytes(byte[] data)
|
||||
=> InternalProvider.GetBytes(data);
|
||||
|
||||
public override void GetNonZeroBytes(byte[] data)
|
||||
=> InternalProvider.GetNonZeroBytes(data);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user