private void buttonRead_Click(object sender, EventArgs e) { Bitmap bitmap = ((sender as Button).Text.Contains("right") ? pictureBoxRight.Image : pictureBoxLeft.Image) as Bitmap; byte[] steganographicKey = Encoding.UTF8.GetBytes(textBoxSteganographicKey.Text); byte[] passpharse = Encoding.UTF8.GetBytes(textBoxPassphrase.Text); if (bitmap == null || passpharse.Length == 0) { MessageBox.Show( @"You need to: - open an image (CTRL + O) - enter the Key" ); return; } byte[] message = ImageDataHider.readMessage(steganographicKey, passpharse, bitmap); textBoxMessage.Text = Encoding.UTF8.GetString(message); MessageBox.Show("Successfully retrieved message from the selected image!"); }
private void buttonHide_Click(object sender, EventArgs e) { Bitmap bitmap = pictureBoxLeft.Image as Bitmap; byte[] steganographicKey = Encoding.UTF8.GetBytes(textBoxSteganographicKey.Text); byte[] passpharse = Encoding.UTF8.GetBytes(textBoxPassphrase.Text); byte[] message = Encoding.UTF8.GetBytes(textBoxMessage.Text); if (bitmap == null || passpharse.Length == 0 || message.Length == 0) { MessageBox.Show( @"You need to: - open an image (CTRL + O) - enter the Passphrase - enter the Message" ); return; } Bitmap newBitmap = ImageDataHider.hideMessage(steganographicKey, passpharse, message, bitmap); pictureBoxRight.Image = newBitmap; MessageBox.Show("Successfully hidden message in the selected image!"); }