/// <inheritdoc /> public override void NextBytes( byte[] buffer, int offset, int count) { lock (this) { _csRng.NextBytes(buffer, offset, count); var maxWindow = Math.Min(count, _maxWindowSize); var windowOffset = _csRng.Next(maxWindow + 1); var windowSize = _csRng.Next(count - windowOffset); Array.Reverse(buffer, offset + windowOffset, windowSize); } }
/** * add the pad bytes to the passed in block, returning the * number of bytes added. */ public int AddPadding( byte[] input, int inOff) { byte code = (byte)(input.Length - inOff); while (inOff < (input.Length - 1)) { input[inOff] = (byte)_random.Next(); inOff++; } input[inOff] = code; return(code); }
/** * add the pad bytes to the passed in block, returning the * number of bytes added. */ public int AddPadding( byte[] input, int inOff) { byte code = (byte)(input.Length - inOff); while (inOff < input.Length - 1) { if (random == null) { input[inOff] = 0; } else { input[inOff] = (byte)random.Next(); } inOff++; } input[inOff] = code; return(code); }