Exemple #1
0
        /// <summary>
        /// Encrypts the data based on the key
        /// </summary>
        /// <param name="Data">Data to encrypt</param>
        /// <param name="Key">Key to use</param>
        /// <returns>The encrypted data</returns>
        public byte[] Encrypt(byte[] Data, byte[] Key)
        {
            Contract.Requires <NullReferenceException>(ShiftAlgorithms != null, "ShiftAlgorithms");
            IShift Found = ShiftAlgorithms.FirstOrDefault();

            if (Found == null)
            {
                throw new ArgumentException("No shift based encryption algorithm found");
            }
            return(Found.Encrypt(Data, Key));
        }