Ejemplo n.º 1
0
        private void hideButton_Click(object sender, EventArgs e)
        {
            bmp = (Bitmap)imagePictureBox.Image; //원본 이미지를 비트맵 포맷으로 저장

            string text = dataTextBox.Text;      //이미지에 삽입할 문자열

            if (text.Equals(""))                 //입력 텍스트가 공백인 경우
            {
                MessageBox.Show("The text you want to hide can't be empty", "Warning");

                return;
            }

            if (encryptCheckBox.Checked)
            {
                if (passwordTextBox.Text.Length < 6)   //복호화에 사용할 키가 6자리 이하일 경우
                {
                    MessageBox.Show("Please enter a password with at least 6 characters", "Warning");

                    return;
                }
                else
                {
                    text = Crypto.EncryptStringAES(text, passwordTextBox.Text); //이미지에 삽입할 텍스트, 사용자 입력 password를 Crypto() 메서드를 이용하여 암호화.
                }                                                               // text에 암호화 결과가 저장된다.
            }

            bmp = SteganographyHelper.embedText(text, bmp); // 이미지에 텍스트 메시지를 삽입하는 메소드

            MessageBox.Show("Your text was hidden in the image successfully!", "Done");

            notesLabel.Text      = "Notes: don't forget to save your new image.";
            notesLabel.ForeColor = Color.OrangeRed;
        }
Ejemplo n.º 2
0
        private void hideButton_Click(object sender, EventArgs e)
        {
            bmp = (Bitmap)imagePictureBox.Image;

            string text = dataTextBox.Text;

            if (text.Equals(""))
            {
                MessageBox.Show("The text you want to hide can't be empty", "Warning");

                return;
            }

            if (encryptCheckBox.Checked)
            {
                if (passwordTextBox.Text.Length < 6)
                {
                    MessageBox.Show("Please enter a password with at least 6 characters", "Warning");

                    return;
                }
                else
                {
                    text = Crypto.EncryptStringAES(text, passwordTextBox.Text);
                }
            }

            bmp = SteganographyHelper.embedText(text, bmp);

            MessageBox.Show("Your text was hidden in the image successfully!", "Done");

            notesLabel.Text      = "Notes: don't forget to save your new image.";
            notesLabel.ForeColor = Color.OrangeRed;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// TODO: Verbergen van data in een afbeelding
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void hideButton_Click(object sender, EventArgs e)
        {
            string _text = dataTextBox.Text;

            bmp = (Bitmap)imagePictureBox.Image;

            if (_text.Equals(""))
            {
                MessageBox.Show("The text you want to hide can't be empty", "Warning");
                return;
            }

            if (encryptCheckBox.Checked)
            {
                if (passwordTextBox.Text.Length < 6)
                {
                    MessageBox.Show("Please enter a password with at least 6 characters", "Warning");
                    return;
                }
                else
                {
                    _text = Crypto.EncryptStringAES(_text, passwordTextBox.Text);
                }
            }

            bmp = SteganographyHelper.embedText(_text, bmp);

            MessageBox.Show("Your text was hidden in the image successfully!", "Done");
            maakLeeg();

            SaveFileDialog save_dialog = new SaveFileDialog();

            save_dialog.Filter = "Png Image|*.png|Bitmap Image|*.bmp";

            if (save_dialog.ShowDialog() == DialogResult.OK)
            {
                switch (save_dialog.FilterIndex)
                {
                case 0:
                {
                    bmp.Save(save_dialog.FileName, ImageFormat.Png);
                } break;

                case 1:
                {
                    bmp.Save(save_dialog.FileName, ImageFormat.Bmp);
                } break;
                }
            }
        }
Ejemplo n.º 4
0
        private void MesajGizle_Click(object sender, EventArgs e)
        {
            bmp = (Bitmap)imagePictureBox.Image;

            string text = girilenMesaj.Text;

            if (text.Equals(""))
            {
                MessageBox.Show("Mesaj Girilmedi!", "Dikkat");

                return;
            }
            if (gelenSifre.Text.Equals(""))
            {
                MessageBox.Show("Şifre Girilmedi!", "Dikkat");

                return;
            }

            text = Crypto.EncryptStringAES(text, gelenSifre.Text);

            bmp = SteganographyHelper.embedText(text, bmp);

            SaveFileDialog save_dialog = new SaveFileDialog();

            save_dialog.Filter = "Png Image|*.png|Bitmap Image|*.bmp";

            if (save_dialog.ShowDialog() == DialogResult.OK)
            {
                switch (save_dialog.FilterIndex)
                {
                case 0:
                {
                    bmp.Save(save_dialog.FileName, ImageFormat.Png);
                }
                break;

                case 1:
                {
                    bmp.Save(save_dialog.FileName, ImageFormat.Bmp);
                }
                break;
                }
            }

            notesLabel.Text      = "Mesaj içerikli resim kayıt oldu.";
            notesLabel.ForeColor = Color.Green;
        }
Ejemplo n.º 5
0
        private void hideButton_Click(object sender, EventArgs e)
        {
            bmp = (Bitmap)imagePictureBox.Image;
            string text = dataTextBox.Text;

            if (text.Equals(""))
            {
                MessageBox.Show("The text you want to hide can't be empty", "Warning");

                return;
            }

            bmp = SteganographyHelper.embedText(text, bmp);
            MessageBox.Show("Your text was hidden in the image successfully!\n", "Done");


            notesLabel.Text      = "Notes: don't forget to save your new image.";
            notesLabel.ForeColor = Color.OrangeRed;
        }
        // ---------------------------------------ACTION----------------------------------------//

        //--Sự kiện click nút DẤU TIN--//
        private void hideButton_Click(object sender, EventArgs e)
        {
            if (openedStego)
            {
                bmp = (Bitmap)imagePictureBox.Image;

                string text = dataTextBox.Text;

                if (text.Equals("")) // kiểm tra ô tin trống?
                {
                    MessageBox.Show("Vui lòng nhập đoạn tin bạn muốn giấu", "Warning");
                    return; //break hàm khi text trống
                }

                bmp = SteganographyHelper.embedText(text, bmp); // Hàm embedText trong class SteganographyHelper
                MessageBox.Show("ĐÃ GIẤU THÀNH CÔNG ĐOẠN TIN VÀO ẢNH CỦA BẠN !", "Done");
                notesLabel.Text      = "Notes: ĐỪNG QUÊN LƯU NÓ LẠI VÀ GỬI CHO NGƯỜI BẠN MUỐN GỬI =))";
                notesLabel.ForeColor = Color.OrangeRed;
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            Bitmap bmp = (Bitmap)pictureBox1.Image;

            string text = textBox1.Text;

            bmp = SteganographyHelper.embedText(text, bmp);
            try
            {
                SaveFileDialog sv = new SaveFileDialog();
                sv.ShowDialog();
                bmp.Save(sv.FileName, System.Drawing.Imaging.ImageFormat.Png);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            leastsignificantbit ls = new leastsignificantbit();

            ls.pic = pictureBox1;
            ls.Show();
        }