Exemplo n.º 1
0
        private void FDEncryptButton_Click(object sender, EventArgs e)
        {
            MicroLibrary.MicroStopwatch utimer = new MicroLibrary.MicroStopwatch();

            Image  inputImage = PlainText_Image.Image;
            String path       = OpenImageDialog.FileName;
            //Bitmap secretImage = ImageEncryption.ImageEncryption.GenerateSecretImage(inputImage.Size);

            SecretImageSelection sis = new SecretImageSelection(inputImage as Bitmap);

            sis.ShowDialog();

            if (sis.DialogResult != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }

            Bitmap secretImage = sis.SecretImage;

            FluidDynamicsKey fdKey = new FluidDynamicsKey(3.717, 0.55, 3.8222, 0.18, 199, 17, 32, secretImage);

            fd          = new FluidDynamicsEncryptor((Bitmap)inputImage, fdKey);
            fd.Filename = path.Substring(path.LastIndexOf('\\') + 1);

            utimer.Start();
            fd.Encrypt();
            utimer.Stop();

            long mem = proc.PrivateMemorySize64;

            EncryptionFinishedActions(fd.CiphertextImage, utimer.ElapsedMicroseconds, mem);
        }
Exemplo n.º 2
0
        private void BioEncryptButton_Click(object sender, EventArgs e)
        {
            MicroLibrary.MicroStopwatch utimer = new MicroLibrary.MicroStopwatch();

            Image  inputImage = PlainText_Image.Image;
            String path       = OpenImageDialog.FileName;

            //Bitmap secretImage = ImageEncryption.
            //    ImageEncryption.GenerateSecretImage(inputImage.Size);

            SecretImageSelection sis = new SecretImageSelection(inputImage as Bitmap);

            sis.ShowDialog();

            if (sis.DialogResult != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }

            Bitmap secretImage = sis.SecretImage;

            // Key from the paper.
            BioInspiredKey bioKey = new BioInspiredKey(
                3.7158, 0.11, 3.89858, 0.25,
                3.76158, 0.35, 3.8458, 0.552,
                secretImage);

            bio          = new BioInspiredEncryptor((Bitmap)inputImage, bioKey);
            bio.Filename = path.Substring(path.LastIndexOf('\\') + 1);

            utimer.Start();
            bio.Encrypt();
            utimer.Stop();

            long mem = proc.PrivateMemorySize64;

            EncryptionFinishedActions(bio.CiphertextImage, utimer.ElapsedMicroseconds, mem);
        }