Fixes RNG (#181)

This commit is contained in:
Kamron Batman 2020-07-25 15:57:32 -07:00 • committed by GitHub
parent 319a990ede
commit ff3a28ab84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 273 additions and 115 deletions

View file

@ -3,7 +3,7 @@
* Copyright (C) 2019-2020 - ModernUO Development Team *
* Email: hi@modernuo.com *
* File: Argon2PasswordProtection.cs *
* Created: 2020/05/01 - Updated: 2020/05/24 *
* Created: 2020/05/01 - Updated: 2020/07/25 *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -20,6 +20,7 @@
*************************************************************************/
using System.Security.Cryptography;
using Server.Random;
namespace Server.Accounting.Security
{
@ -27,7 +28,7 @@ namespace Server.Accounting.Security
{
public static IPasswordProtection Instance = new Argon2PasswordProtection();
private Argon2PasswordHasher m_PasswordHasher = new Argon2PasswordHasher(
rng: RandomProviders.SecureProvider as RandomNumberGenerator
rng: (RandomSources.SecureSource as SecureRandom)?.Generator
);
public string EncryptPassword(string plainPassword) =>

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server.Random;
namespace Server.Engines.Harvest
{
@ -116,7 +117,7 @@ namespace Server.Engines.Harvest
if (RandomizeVeins) return GetVeinFrom(Utility.Random(1000u));
// TODO: Introduce pulling primes from a config and writing them if they don't exist to the config
using Xoshiro256PlusPlus random = new Xoshiro256PlusPlus((ulong)(x * 17 + y * 11 + map.MapID * 3));
var random = new Xoshiro256PlusPlus((ulong)(x * 17 + y * 11 + map.MapID * 3));
return GetVeinFrom(random.Next(VeinWeights));
}