Example #1
0
        /// <summary>
        /// 获得初始向量IV数组
        /// </summary>
        /// <returns>初试向量IV数组</returns>
        private byte[] GetLegalIV()
        {
            string result = iv;

            mCrypto.GenerateIV();
            byte[] ivBytes  = mCrypto.IV;
            int    ivLength = ivBytes.Length;

            if (result.Length > ivLength)
            {
                result = result.Substring(0, ivLength);
            }
            else if (result.Length < ivLength)
            {
                result = result.PadRight(ivLength, ' ');
            }
            return(ASCIIEncoding.ASCII.GetBytes(result));
        }
 public override void GenerateIV() => _impl.GenerateIV();