Example #1
0
        // the factory methods are just simple mappings to the private constructors
        public override ICryptoTransform CreateEncryptor(
            byte[] key,
            byte[] iv
            )
        {
            var result = new Blowfish(
                key,
                iv,
                CipherMode.CBC == ModeValue,
                true);

            result.Padding = Padding;
            return result;
        }
Example #2
0
        /// <summary>
        ///     checks if a key is weak (and perhaps shouldn't be used)
        /// </summary>
        /// <param name="key">
        ///     the key material to test against
        /// </param>
        /// <returns>
        ///     true: key is "weak" / false: key passed the test
        /// </returns>
        public static bool IsWeakKey(byte[] key)
        {
            var bfAlg = new Blowfish(key, null, false, true);

            return bfAlg.mBlowfishBase.IsWeakKey;
        }