Пример #1
0
        public static string GetDecryptedTextFromImageLinear(Image image)
        {
            Bitmap     img       = new Bitmap(image);
            int        maxLinear = image.Width * image.Height;
            string     pass      = string.Format("{0}x{1}={2}", image.Width, image.Height, maxLinear);
            AESEncrypt encrypt   = new AESEncrypt();
            string     text      = string.Empty;
            int        value     = 0;
            int        i         = 0;

            OutputConsole.Write("Processing image...");
            do
            {
                Point point = LinearIndexToPoint(i, image.Width, image.Height);
                Color pixel = img.GetPixel(point.X, point.Y);
                value = DecodePixel(pixel);
                i++;
                if (value != 255)
                {
                    text += Convert.ToChar(value);
                }
            } while (value != 255);
            try
            {
                OutputConsole.Write(string.Format("String found: \n{0}", text));
                OutputConsole.Write("Decrypting text...");
                return(encrypt.DecryptString(text, pass));
            }
            catch (Exception e)
            {
                OutputConsole.Write("Error: Text not found");
                Console.WriteLine(e.Message);
                return(null);
            }
        }
Пример #2
0
        public static string DecryptTextLinear(byte[] wav)
        {
            WavAudio   audio   = new WavAudio(wav);
            string     text    = string.Empty;
            uint       n       = 0;
            uint       value   = 0;
            string     pass    = string.Format(audio.bitsPerSample.ToString());
            AESEncrypt encrypt = new AESEncrypt();

            OutputConsole.Write("Processing wav file...");
            do
            {
                value = 0;
                for (int x = 0; x < 8; x++)
                {
                    uint sample      = n;
                    uint sampleValue = audio.samples[sample];
                    value = value | ((sampleValue & 1) << x);
                    n++;
                }
                if (value != 0)
                {
                    text += Convert.ToChar(value);
                }
            } while (value != 0);
            OutputConsole.Write("Decrypting text...");
            try
            {
                return(encrypt.DecryptString(text, pass));
            }
            catch (Exception e)
            {
                OutputConsole.Write("Error: Text not found");
                Console.WriteLine(e.Message);
                return(null);
            }
        }