Example #1
0
        /// <summary>
        ///     Encrypts the image embedding.
        /// </summary>
        /// <param name="pixels">The pixels.</param>
        /// <param name="sourcePicture">The source picture.</param>
        /// <param name="hiddenPicture">The hidden picture.</param>
        public static void EncryptImage(byte[] pixels, Picture sourcePicture, Picture hiddenPicture)
        {
            for (var i = 0; i < sourcePicture.Height; i++)
            {
                for (var j = 0; j < sourcePicture.Width; j++)
                {
                    j = HeaderManager.SkipHeaderLocation(i, j);
                    var sourcePixelColor =
                        PixelUtilities.GetPixelBgra8(pixels, i, j, sourcePicture.Width, sourcePicture.Height);
                    var hiddenPixelColor = Colors.White;
                    hiddenPixelColor =
                        getOppositeVerticalHalfPixelColor(i, j, hiddenPixelColor, sourcePicture, hiddenPicture);

                    if (PixelUtilities.IsColorBlack(hiddenPixelColor))
                    {
                        embedBlackPixel(pixels, sourcePixelColor, i, j, sourcePicture);
                    }

                    else
                    {
                        embedWhitePixel(pixels, sourcePixelColor, i, j, sourcePicture);
                    }
                }
            }
        }
Example #2
0
        private void checkBpccValue()
        {
            var sourcePixelColor = PixelUtilities.GetPixelBgra8(this.sourcePicture.Pixels, ImageConstants.FirstX,
                                                                ImageConstants.SecondX, this.sourcePicture.Width,
                                                                this.sourcePicture.Height);

            this.bpcc = HeaderManager.CheckBpccValue(sourcePixelColor);
        }
Example #3
0
        /// <summary>
        ///     Determines whether [contains hidden message].
        /// </summary>
        /// <returns>
        ///     <c>true</c> if [contains hidden message]; otherwise, <c>false</c>.
        /// </returns>
        public bool ContainsHiddenMessage()
        {
            var sourcePixelColor = PixelUtilities.GetPixelBgra8(this.sourcePicture.Pixels, ImageConstants.FirstX,
                                                                ImageConstants.FirstX,
                                                                this.sourcePicture.Width,
                                                                this.sourcePicture.Height);

            return(HeaderManager.ContainsHiddenMessage(sourcePixelColor));
        }
Example #4
0
        /// <summary>
        ///     Determines whether this instance is text.
        /// </summary>
        /// <returns>
        ///     <c>true</c> if this instance is text; otherwise, <c>false</c>.
        /// </returns>
        public bool IsText()
        {
            var sourcePixelColor = PixelUtilities.GetPixelBgra8(this.sourcePicture.Pixels, ImageConstants.FirstX,
                                                                ImageConstants.SecondX,
                                                                this.sourcePicture.Width,
                                                                this.sourcePicture.Height);

            return(HeaderManager.CheckFileType(sourcePixelColor));
        }
Example #5
0
        /// <summary>
        ///     Determines whether this instance is encrypted.
        /// </summary>
        /// <returns>
        ///     <c>Encrypted</c> if this instance is encrypted; otherwise, <c>Unencrypted</c>.
        /// </returns>
        public EncryptionType IsEncrypted()
        {
            var sourcePixelColor = PixelUtilities.GetPixelBgra8(this.sourcePicture.Pixels, ImageConstants.FirstX,
                                                                ImageConstants.SecondX,
                                                                this.sourcePicture.Width,
                                                                this.sourcePicture.Height);

            return(HeaderManager.CheckForEncryption(sourcePixelColor));
        }
Example #6
0
        private void imageEmbedding(byte[] pixels)
        {
            for (var i = 0; i < this.hiddenPicture.Height; i++)
            {
                for (var j = 0; j < this.hiddenPicture.Width; j++)
                {
                    j = HeaderManager.SkipHeaderLocation(i, j);

                    this.embedPixel(pixels, i, j);
                }
            }
        }
Example #7
0
        private void updateSourceImage(IReadOnlyList <byte> bytes)
        {
            var index = 0;

            for (var i = 0; i < this.sourcePicture.Height; i++)
            {
                for (var j = 0; j < this.sourcePicture.Width; j++)
                {
                    j     = HeaderManager.SkipHeaderLocation(i, j);
                    index = this.updatePixel(bytes, i, j, index);
                }
            }
        }
Example #8
0
 /// <summary>
 ///     Extracts the image.
 /// </summary>
 /// <param name="pixels">The pixels.</param>
 public void ExtractImage(byte[] pixels)
 {
     for (var i = 0; i < this.sourcePicture.Height; i++)
     {
         for (var j = 0; j < this.sourcePicture.Width; j++)
         {
             j = HeaderManager.SkipHeaderLocation(i, j);
             var hiddenPixelColor = PixelUtilities.GetPixelBgra8(pixels, i, j,
                                                                 this.sourcePicture.Width,
                                                                 this.sourcePicture.Height);
             this.setPixelToMonochromeColor(pixels, hiddenPixelColor, i, j);
         }
     }
 }
Example #9
0
        private void checkForEncryption()
        {
            var sourcePixelColor = PixelUtilities.GetPixelBgra8(this.sourcePicture.Pixels, ImageConstants.FirstX,
                                                                ImageConstants.SecondX, this.sourcePicture.Width,
                                                                this.sourcePicture.Height);

            if (HeaderManager.CheckForEncryption(sourcePixelColor) == EncryptionType.Encrypted)
            {
                this.isEncrypted = true;
            }
            else
            {
                this.isEncrypted = false;
            }
        }