예제 #1
0
        public string Encrypt(string inputString, bool base32 = true)
        {
            MemoryStream             ms  = new MemoryStream();
            DESCryptoServiceProvider key = new DESCryptoServiceProvider();
            //SymmetricAlgorithm key = SymmetricAlgorithm.Create();

            CryptoStream encStream = new CryptoStream(ms, key.CreateEncryptor(deKey, deIV), CryptoStreamMode.Write);
            StreamWriter sw        = new StreamWriter(encStream);

            sw.WriteLine(inputString);
            sw.Close();
            encStream.Close();

            byte[] buffer = ms.ToArray();
            ms.Close();
            var result = Convert.ToBase64String(buffer);

            if (base32)
            {
                return(Base32.Encode(buffer));
            }
            return(result);
        }