Пример #1
0
 private void InitializeGenerator(byte[] bytes)
 {
     _state = new GeneratorState
     {
         Counter = new System.Numerics.BigInteger(),
         Key     = new byte[32]
     };
     Reseed(bytes);
 }
Пример #2
0
 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
         {
             Counter = counter,
             Key     = newKey
         };
     }
 }