示例#1
0
 private void GetLengthPositions()
 {
     for (int i = 0; i < 32; i++)
     {
         lengthPositions.Add(currentPosition);
         helper.SetNextCurrentPosition(ref currentPosition, positions);
     }
 }
示例#2
0
 private void Initialize(Bitmap image)
 {
     helper      = new EncoderDecoderHelper();
     Image       = image;
     pixelColors = new byte[image.Height * image.Width * 3];
     helper.FillPositionArray(image, positions);
     helper.SetNextCurrentPosition(ref currentPosition, positions);
     helper.FillPixelColorsArray(image, pixelColors);
 }
示例#3
0
 public void Reset()
 {
     helper      = new EncoderDecoderHelper();
     allText     = new StringBuilder();
     pixelColors = new byte[Image.Height * Image.Width * 3];
     helper.FillPositionArray(Image, positions);
     helper.SetNextCurrentPosition(ref currentPosition, positions);
     helper.FillPixelColorsArray(Image, pixelColors);
     GetLengthPositions();
 }
示例#4
0
        public string GetTextFromImage()
        {
            BitArray lengthArray = new BitArray(32);

            for (int i = 0; i < 32; i++)
            {
                lengthArray[i] = pixelColors[currentPosition].GetFirstBit();
                helper.SetNextCurrentPosition(ref currentPosition, positions);
            }

            var      length = lengthArray.GetAsByteArray().GetAsInt();
            BitArray text   = new BitArray(length);

            for (int i = 0; i < length; i++)
            {
                text[i] = pixelColors[currentPosition].GetFirstBit();
                helper.SetNextCurrentPosition(ref currentPosition, positions);
            }

            return(Encryptor.Decrypt(Statics.passwordHash, text.GetAsByteArray()));
        }