Пример #1
0
        /// <summary>
        ///     Decodes the text message from the bitmap.
        ///     Precondition: none
        ///     Post-condition: none
        /// </summary>
        /// <returns>The embedded text message from the color channel bytes.</returns>
        public string DecodeTextMessage()
        {
            var binaryMessage = string.Empty;

            for (var y = 0; y < this.Height; y++)
            {
                for (var x = 0; x < this.Width; x++)
                {
                    if (TextDecoder.EndsWithStopIndicator(binaryMessage))
                    {
                        break;
                    }

                    binaryMessage = this.extractMessageBitsFromPixel(x, y, binaryMessage);
                }
            }

            return(this.headerPixels.HasEncryption ? TextCipher.DecryptText(binaryMessage.ConvertBinaryToString()) :
                   TextDecoder.RemoveDecodeIndicator(binaryMessage.ConvertBinaryToString()));
        }
Пример #2
0
 private static string setupTextMessage(string message, string encryptionKey)
 {
     message  = TextCipher.EncryptTextWithKey(message, encryptionKey);
     message += TextDecoder.DecodingStopIndicator + " ";
     return(message.ConvertToBinary());
 }