private void InitializeGenerator(byte[] seed) { _state = new GeneratorState { Counter = new BigInteger(), Key = new byte[KeyBlockSize] }; Reseed(seed); }
public void Reseed(byte[] seed) { using (var sha = SHA256.Create()) { var newKey = GetNewKey(sha.ComputeHash(_state.Key.Concat(seed).ToArray())); var counter = ++_state.Counter; _state = new GeneratorState { Key = newKey, Counter = counter }; } }