Changeset 2571 for trunk/eraser/Eraser.Manager/EntropyPoller.cs
- Timestamp:
- 3/22/2012 2:58:33 AM (14 months ago)
- File:
-
- 1 edited
-
trunk/eraser/Eraser.Manager/EntropyPoller.cs (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/eraser/Eraser.Manager/EntropyPoller.cs
r2570 r2571 46 46 public EntropyPoller() 47 47 { 48 //Create the pool .48 //Create the pool and its complement. 49 49 Pool = new byte[sizeof(uint) << 7]; 50 PoolInvert = new byte[Pool.Length]; 51 for (uint i = 0, j = (uint)PoolInvert.Length; i < j; ++i) 52 PoolInvert[i] = byte.MaxValue; 50 53 51 54 //Handle the Entropy Source Registered event. … … 162 165 163 166 /// <summary> 164 /// Inverts the contents of the pool 167 /// Inverts the contents of the pool. 165 168 /// </summary> 166 169 private void InvertPool() 167 170 { 168 171 lock (PoolLock) 169 unsafe 170 { 171 fixed (byte* fPool = Pool) 172 { 173 uint* pPool = (uint*)fPool; 174 uint poolLength = (uint)(Pool.Length / sizeof(uint)); 175 while (poolLength-- != 0) 176 *pPool = (uint)(*pPool++ ^ uint.MaxValue); 177 } 178 } 172 { 173 MemoryXor(PoolInvert, 0, Pool, 0, Pool.Length); 174 } 179 175 } 180 176 … … 323 319 324 320 /// <summary> 321 /// A pool, the same size as <see cref="Pool"/>, but containing all bitwise 1's 322 /// for XOR for pool inversion 323 /// </summary> 324 private byte[] PoolInvert; 325 326 /// <summary> 325 327 /// The next position where entropy will be added to the pool. 326 328 /// </summary>
Note: See TracChangeset
for help on using the changeset viewer.
