public BlowfishOutputStream(Blowfish blowfish, Stream stream, int bufferSize, bool leaveOpen)
        {
            Blowfish    = blowfish ?? throw new ArgumentNullException(nameof(blowfish));
            this.stream = stream ?? throw new ArgumentNullException(nameof(stream));
            if (bufferSize < 8)
            {
                throw ArgumentOutOfRangeUtils.OutsideMin(nameof(bufferSize), bufferSize, 8, true);
            }
            if (bufferSize % 8 != 0)
            {
                throw new ArgumentException($"{nameof(bufferSize)} must be a multiple of 8!");
            }
            if (!stream.CanWrite)
            {
                throw new ArgumentException($"{nameof(BlowfishOutputStream)} only supports streams that can write!");
            }

            decryptedBuffer = new byte[bufferSize];
            virtualPosition = 0;
            this.leaveOpen  = leaveOpen;
        }
コード例 #2
0
 public BlowfishInputStream(Blowfish blowfish, Stream stream, int length, int bufferSize)
     : this(blowfish, stream, length, bufferSize, false)
 {
 }
コード例 #3
0
 public BlowfishInputStream(Blowfish blowfish, Stream stream, int length, bool leaveOpen)
     : this(blowfish, stream, length, DefaultBufferSize, leaveOpen)
 {
 }
コード例 #4
0
 public BlowfishInputStream(Blowfish blowfish, Stream stream, int length)
     : this(blowfish, stream, length, DefaultBufferSize, false)
 {
 }
 public BlowfishOutputStream(Blowfish blowfish, Stream stream, int bufferSize)
     : this(blowfish, stream, bufferSize, false)
 {
 }
 public BlowfishOutputStream(Blowfish blowfish, Stream stream, bool leaveOpen)
     : this(blowfish, stream, DefaultBufferSize, leaveOpen)
 {
 }
 public BlowfishOutputStream(Blowfish blowfish, Stream stream)
     : this(blowfish, stream, DefaultBufferSize, false)
 {
 }