using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;
using Renci.SshNet.Security.Cryptography;
namespace Renci.SshNet.Security
{
    /// 
    /// Represents base class for AES based encryption.
    /// 
    public class CipherBlowfish : Cipher
    {
        /// 
        /// Gets algorithm name.
        /// 
        public override string Name
        {
            get { return "blowfish-cbc"; }
        }
        /// 
        /// Gets or sets the key size, in bits, of the secret key used by the cipher.
        /// 
        /// 
        /// The key size, in bits.
        /// 
        public override int KeySize
        {
            get
            {
                return 16 * 8;
            }
        }
        /// 
        /// Gets or sets the block size, in bits, of the cipher operation.
        /// 
        /// 
        /// The block size, in bits.
        /// 
        public override int BlockSize
        {
            get
            {
                return 8;
            }
        }
        /// 
        /// Creates the encryptor.
        /// 
        /// 
        protected override ModeBase CreateEncryptor()
        {
            return new CbcMode(new BlowfishCipher(this.Key.Take(this.KeySize / 8).ToArray(), this.Vector.Take(this.BlockSize).ToArray()));
        }
        /// 
        /// Creates the decryptor.
        /// 
        /// 
        protected override ModeBase CreateDecryptor()
        {
            return new CbcMode(new BlowfishCipher(this.Key.Take(this.KeySize / 8).ToArray(), this.Vector.Take(this.BlockSize).ToArray()));
        }
    }
}