示例#1
1
        static void Main(string[] args)
        {
            WriteLine("暗号キーを5文字(アルファベット)入力して下さい");
            var key = Console.ReadLine();

            WriteLine("暗号化したテキストを入力して下さい");
            var message = Console.ReadLine();

            WriteLine("暗号化 Start");

            var crypto = new RC2(key, message);
            crypto.Encrypt();

            WriteLine("暗号化 End");
            WriteLine("");
            WriteLine(crypto.EncryptMessage);
            WriteLine("");
            WriteLine("");

            WriteLine("復号化 Start");
            crypto.Decrypt();
            WriteLine("復号化 End");
            WriteLine(crypto.NomarlMessage);

            Console.ReadLine();
        }
示例#2
0
        static void Main(string[] args)
        {
            WriteLine("暗号キーを5文字(アルファベット)入力して下さい");
            var key = Console.ReadLine();


            WriteLine("暗号化したテキストを入力して下さい");
            var message = Console.ReadLine();


            WriteLine("暗号化 Start");

            var crypto = new RC2(key, message);

            crypto.Encrypt();

            WriteLine("暗号化 End");
            WriteLine("");
            WriteLine(crypto.EncryptMessage);
            WriteLine("");
            WriteLine("");

            WriteLine("復号化 Start");
            crypto.Decrypt();
            WriteLine("復号化 End");
            WriteLine(crypto.NomarlMessage);



            Console.ReadLine();
        }
示例#3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var iv = this.EncryptIv.Text;
                var key = this.EncryptCryptoKey.Text;
                var message = this.EncryptNomalMessage.Text;

                var crp = new RC2(key, message);
                crp.IV = iv;

                crp.Encrypt();

                this.EncryptResult.Text = crp.EncryptMessage;
            }catch(Exception ex)
            {
                this.EncryptResult.Text = ex.Message;
            }
        }
示例#4
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {
                var iv = this.DecryptIv.Text;
                var key = this.DecryptCryptoKey.Text;
                var cryptoMessage = this.DecryptCryptoMessage.Text;

                var crp = new RC2(key, "");
                crp.IV = iv;
                crp.EncryptMessage = cryptoMessage;

                crp.Decrypt();
                this.DecryptResult.Text = crp.NomarlMessage;
            }
            catch (Exception ex)
            {
                this.DecryptResult.Text = "Exception="+ex.Message;
            }
        }