示例#1
0
        public void Encrypt_Normal(string plainText, string expetedText)
        {
            var plainBytes     = Encoding.UTF8.GetBytes(plainText);
            var encryptedBytes = _desCryptoUtil.Encrypt(plainBytes, DesCryptoSetting.Key, DesCryptoSetting.Iv);
            var result         = Convert.ToBase64String(encryptedBytes);

            Assert.AreEqual(expetedText, result);
        }
示例#2
0
        public void Encrypt(string plainText)
        {
            var plainBytes     = _bytesUtil.FromString(plainText);
            var encryptedBytes = _desCryptoUtil.Encrypt(plainBytes);
            var encryptedText  = _bytesUtil.ToBase64(encryptedBytes);

            Console.WriteLine("Plain text:{0}, encrypted text:{1}", plainText, encryptedText);
        }