Example #1
0
        public static async Task <ProcessingResult> Decrypt(string originalFileName, Bitmap originalKeyBitmap)
        {
            var decryptionFileName = $"{originalFileName}_Container";
            var decryptionFilePath = Path.Combine(MainConstants.ContainersProcessedPath, $"{decryptionFileName}.bmp");

            var decryptionStopwatch = Stopwatch.StartNew();
            var decryptionResult    = await Svd.Decrypt(new Bitmap(decryptionFilePath), decryptionFileName);

            decryptionStopwatch.Stop();
            var decryptionPsnr = Helpers.CalculatePsnr(originalKeyBitmap, decryptionResult);

            return(new ProcessingResult
            {
                Psnr = decryptionPsnr,
                Time = decryptionStopwatch.Elapsed
            });
        }
Example #2
0
        public static async Task <ProcessingResult> DecryptFromBitmap(Bitmap encrypptedContainer, string originalFileName, Bitmap originalKeyBitmap)
        {
            var decryptionFileName = $"{originalFileName}_Container";

            var decryptionStopwatch = Stopwatch.StartNew();
            var decryptionResult    = await Svd.Decrypt(encrypptedContainer, decryptionFileName,
                                                        originalKeyBitmap.Width, originalKeyBitmap.Height);

            decryptionStopwatch.Stop();
            var decryptionMse  = Helpers.CalculateMse(originalKeyBitmap, decryptionResult);
            var decryptionPsnr = Helpers.CalculatePsnr(decryptionMse);

            originalKeyBitmap.Dispose();
            return(new ProcessingResult
            {
                Psnr = decryptionPsnr,
                Mse = decryptionMse,
                Time = decryptionStopwatch.Elapsed,
                ExtractedWatermark = decryptionResult
            });
        }