示例#1
0
        private Blowfish(
            byte[] key,
            byte[] iv,
            bool blCBC,
            bool blIsEncryptor
            )
        {
            if (null == key) GenerateKey();
            else Key = key;

            if (blCBC)
            {
                if (null == iv) GenerateIV();
                else IV = iv;

                mBlowfishBase = null;
                mBlowfishBaseCbc = new BlowfishBaseCbc(KeyValue, IVValue);
            }
            else
            {
                mBlowfishBase = new BlowfishBase(KeyValue);
                mBlowfishBaseCbc = null;
            }

            m_blIsEncryptor = blIsEncryptor;
        }
示例#2
0
        /// <summary>
        ///     constructor
        /// </summary>
        public Blowfish()
        {
            mBlowfishBase = null;
            mBlowfishBaseCbc = null;

            // FIXME: are we supposed to create a default key and IV?
            IVValue = null;
            KeyValue = null;
            KeySizeValue = BlowfishBase.MAXKEYLENGTH*8;

            LegalBlockSizesValue = new KeySizes[1];
            LegalBlockSizesValue[0] = new KeySizes(BlockSize, BlockSize, 8);

            LegalKeySizesValue = new KeySizes[1];
            LegalKeySizesValue[0] = new KeySizes(0, BlowfishBase.MAXKEYLENGTH*8, 8);

            ModeValue = CipherMode.ECB;

            m_rng = null;
        }
示例#3
0
        /// <summary>
        ///     constructor
        /// </summary>
        public Blowfish()
        {
            mBlowfishBase    = null;
            mBlowfishBaseCbc = null;

            // FIXME: are we supposed to create a default key and IV?
            IVValue      = null;
            KeyValue     = null;
            KeySizeValue = BlowfishBase.MAXKEYLENGTH * 8;

            LegalBlockSizesValue    = new KeySizes[1];
            LegalBlockSizesValue[0] = new KeySizes(BlockSize, BlockSize, 8);

            LegalKeySizesValue    = new KeySizes[1];
            LegalKeySizesValue[0] = new KeySizes(0, BlowfishBase.MAXKEYLENGTH * 8, 8);

            ModeValue = CipherMode.ECB;

            m_rng = null;
        }
示例#4
0
        private Blowfish
        (
            byte[] key,
            byte[] iv,
            bool blCBC,
            bool blIsEncryptor
        )
        {
            if (null == key)
            {
                GenerateKey();
            }
            else
            {
                Key = key;
            }

            if (blCBC)
            {
                if (null == iv)
                {
                    GenerateIV();
                }
                else
                {
                    IV = iv;
                }

                mBlowfishBase    = null;
                mBlowfishBaseCbc = new BlowfishBaseCbc(KeyValue, IVValue);
            }
            else
            {
                mBlowfishBase    = new BlowfishBase(KeyValue);
                mBlowfishBaseCbc = null;
            }

            m_blIsEncryptor = blIsEncryptor;
        }