Browse Source

initial commit

Jose Ortiz 9 years ago
commit
4a0daa88a7
37 changed files with 3385 additions and 0 deletions
  1. 647
    0
      README.md
  2. 106
    0
      StegaPanel.cpp
  3. 45
    0
      StegaPanel.h
  4. 241
    0
      StegaPanel.ui
  5. 25
    0
      Steganography.pro
  6. 271
    0
      Steganography.pro.user
  7. 5
    0
      images.qrc
  8. BIN
      images/Bitwise.png
  9. BIN
      images/ejemplo.png
  10. BIN
      images/figure1.png
  11. BIN
      images/figure2.png
  12. BIN
      images/figure3.png
  13. BIN
      images/gallito.png
  14. BIN
      images/img1.png
  15. BIN
      images/img2.png
  16. BIN
      images/main1.png
  17. BIN
      images/main2.png
  18. BIN
      images/main3.png
  19. BIN
      images/pink.png
  20. BIN
      images/pug.png
  21. BIN
      images/puppy.png
  22. BIN
      images/uprTorre.png
  23. BIN
      images/vacas.png
  24. 11
    0
      main.cpp
  25. 159
    0
      mainwindow.cpp
  26. 103
    0
      mainwindow.h
  27. 296
    0
      mainwindow.ui
  28. 123
    0
      moc_StegaPanel.cpp
  29. 106
    0
      panel.cpp
  30. 45
    0
      panel.h
  31. 336
    0
      panel.ui
  32. BIN
      resources/logo.png
  33. 22
    0
      stega.pro
  34. 292
    0
      steganography.cpp
  35. 148
    0
      steganography.h
  36. 202
    0
      ui_StegaPanel.h
  37. 202
    0
      ui_panel.h

+ 647
- 0
README.md View File

@@ -0,0 +1,647 @@
1
+[English](#markdown-header-repetition-structures-steganography) | [Español](#markdown-header-estructuras-de-repeticion-esteganografia)
2
+
3
+#Estructuras de repetición - Esteganografía
4
+
5
+![main1.png](images/main1.png)
6
+![main2.png](images/main2.png)
7
+![main3.png](images/main3.png)
8
+
9
+Una de las ventajas de utilizar programas de computadoras es que podemos realizar tareas repetitivas fácilmente. Los ciclos como `for`, `while`, y `do-while` son estructuras de control que nos permiten repetir un conjunto de instrucciones. A estas estructuras también se les llama *estructuras de repetición*.  En la experiencia de laboratorio de hoy completarás una aplicación de esteganografía para practicar el uso de ciclos anidados en la manipulación de arreglos bi-dimensionales.
10
+
11
+
12
+##Objetivos:
13
+
14
+1. Aplicar ciclos anidados y estructuras de control para manipular arreglos bi-dimensionales y  extraer mensajes escondidos en imágenes.
15
+
16
+2. Utilizar programación modular.
17
+
18
+3. Utilizar la representación binaria de caracteres.
19
+
20
+
21
+##Pre-Lab:
22
+
23
+Antes de llegar al laboratorio debes haber:
24
+
25
+
26
+1. Repasado los conceptos básicos relacionados a estructuras de repetición, arreglos bi-dimensionales y estructuras de control.
27
+
28
+2. Estudiado los conceptos de componentes de color de los pixeles de imágenes.
29
+
30
+3. Estudiado la representación binaria de caracteres.
31
+
32
+4. Repasado los métodos de manipulación de "strings".
33
+
34
+5. Estudiado los conceptos e instrucciones de la sesión de laboratorio.
35
+
36
+6. Tomado el quiz Pre-Lab que se encuentra en Moodle.
37
+
38
+---
39
+
40
+---
41
+
42
+
43
+
44
+##Esteganografía
45
+
46
+La esteganografía es la ciencia de camuflar la presencia de mensajes ocultos en portadores legítimos (archivos que parecen inofensivos). Esta ciencia ha sido utilizada por delincuentes cibernéticos para ocasionar daños a sistemas de computadoras, y por terroristas para codificar mensajes ocultos en transmisiones de internet. Se dice que Al-Qaeda puede haber utilizado esteganografía para codificar mensajes en imágenes y luego transportarlos por correo electrónico, y posiblemente por USENET, para preparar y ejecutar los ataques terroristas del 11 de septiembre de 2001.
47
+
48
+La esteganografía también tiene algunos usos legales [1]:
49
+
50
+* Un laboratorio de imágenes médicas puede empotrar información del paciente en las imágenes y así prevenir fraude y/o errores en los diagnósticos del paciente.
51
+* Podemos usar información oculta para identificar los dueños legítimos de un documento o imagen. Si el documento se filtra o se distribuye sin autorización, se puede trazar su origen hasta el dueño legítimo y quizás descubrir quién rompió el acuerdo de distribución.
52
+
53
+En esta experiencia de laboratorio implementarás un algoritmo simple para extraer mensajes ocultos en imágenes usando técnicas de esteganografía.
54
+
55
+---
56
+
57
+
58
+##Edición de imágenes
59
+
60
+En esta experiencia de laboratorio, recuperarás un mensaje secreto que ha sido ocultado en una imagen. Para poder realizar tu tarea debes entender algunos conceptos relacionados a imágenes, conocer métodos de la clase `QImage` de `Qt` y funciones para trabajar con datos de tipo `QRgb`.
61
+
62
+###Píxeles
63
+
64
+Al elemento más pequeño de una imagen se le llama un *píxel*. Esta unidad consiste de un solo color. Como cada color es una combinación de tonalidades de los colores primarios rojo, verde y azul,   se codifica como un entero sin signo cuyos bytes  representan los tonos de rojo, verde y azul del pixel  (Figura 1). A esta combinación se le llama el *RGB* del color por las siglas de "Red-Green-Blue". Por ejemplo, un píxel de color rojo (puro) tiene una representación RGB `0x00ff0000`, mientras que un píxel de color blanco tiene una representación RGB de `0x00FFFFFF` (ya que el color blanco es la combinación de los tonos rojo, verde y azul en toda su intensidad).
65
+
66
+---
67
+
68
+![figure1.png](images/figure1.png)
69
+
70
+**Figura 1.** Distribución de bits para las tonalidades de rojo, verde y azul dentro de la representación RGB.  Cada tonalidad puede tener valores entre 0x00 (los ocho bits en 0) y 0xFF (los 8 bits en 1). 
71
+
72
+---
73
+
74
+En `Qt` se utiliza el tipo `QRgb` para representar valores `RGB`.  Utilizando las funciones que describimos abajo podemos realizar algunas operaciones importantes de análisis de imágenes, tales como determinar el RGB de cada píxel de una imagen, y obtener los componentes rojo, verde y azul del valor `QRgb` del píxel.
75
+
76
+###Biblioteca
77
+
78
+La experiencia de laboratorio de hoy utilizará la clase `QImage`. Esta clase permite acceder a los datos de los pixeles de una imagen para poder manipularla. La documentación de la clase `QImage` se encuentra en http://doc.qt.io/qt-4.8/qimage.html.
79
+
80
+El código que te proveemos en el archivo `steganography.cpp` contiene los siguiente objetos de la clase `QImage`:
81
+
82
+* `origImage`   // contiene la información de la imagen original donde se empotró el mensaje
83
+*  `newImage`  // contendrá la imagen con el mensaje oculto
84
+
85
+Los objetos de clase `QImage` tienen los siguiente métodos que serán útiles para la experiencia de laboratorio de hoy:
86
+
87
+
88
+* `width()`      // devuelve el ancho de la imagen (un número entero positivo)
89
+* `height()`      // devuelve la altura de la imagen (un número entero positivo)
90
+* `pixel(i, j)`       // devuelve el `QRgb` del píxel en la posición `(i,j)`
91
+
92
+Las siguientes funciones te serán útiles para trabajar con datos de tipo `QRgb`:
93
+
94
+* `qRed(pixel)`   // devuelve el tono del color rojo del píxel, i.e. un valor entre (0x00 y 0xFF)
95
+* `qGreen(pixel)` // devuelve el tono del color verde del píxel, i.e. un valor entre (0x00 y 0xFF)
96
+* `qBlue(pixel)`  // devuelve el tono del color azul del píxel, i.e. un valor entre (0x00 y 0xFF)
97
+
98
+
99
+####Ejemplos:
100
+
101
+1. Si la siguiente imagen `4 x 4` de píxeles representa el objeto `origImage`,
102
+
103
+    ![ejemplo.png](images/ejemplo.png)
104
+
105
+  entonces `origImage.pixel(2,1)` devuelve un valor `rgb` que representa el color azul (`0x0000ff`).
106
+
107
+2. La siguiente instrucción le asigna a la variable `greenContent` el valor del tono de verde que contiene el píxel `(1,1)` de  `origImage`:
108
+
109
+  `int greenContent = qGreen(origImage.pixel(1,1));`.
110
+
111
+
112
+3. El siguiente programa crea un objeto de clase `QImage` e imprime los componentes rojo, verde y azul del pixel en el centro de la imagen. La imagen utilizada es la que se especifica dentro del paréntesis durante la creación del objeto, esto es, el archivo `chuck.png`.
113
+
114
+---
115
+
116
+```cpp
117
+#include <QImage>
118
+#include <iostream>
119
+
120
+using namespace std;
121
+int main() {
122
+    QImage myImage(“/Users/rarce/Downloads/chuck.png”);
123
+    QRgb    centralPixel;
124
+
125
+    centralPixel = myImage.pixel(myImage.width() / 2, myImage.height() / 2);
126
+
127
+    cout    << hex;
128
+
129
+    cout    << “Los componentes rojo, verde y azul del pixel central son: “
130
+        << qRed(centralPixel) << “, “
131
+        << qGreen(centralPixel) << “, “
132
+        << qBlue(centralPixel) << endl;
133
+    return 0;
134
+}
135
+```
136
+
137
+
138
+###Empotrando un mensaje en una imagen
139
+
140
+Uno de los métodos más simples para esconder un mensaje en una imagen es codificando el mensaje en los bits menos significativos de los componentes de los colores de los píxeles de la imagen. Este método esconde el mensaje en la imagen eficientemente porque el efecto al cambiar el bit menos significativo en un color de 8 bits es casi imperceptible para el ojo humano.
141
+
142
+Por ejemplo, la Figura 2 muestra dos píxeles gigantes, el de la izquierda  es de color `0xff0000`y el de la derecha es de color `0xfe0101`. Recuerda que el **byte** más significativo (esto es, los dos dígitos hexadecimales más a la izquierda) representan la intensidad del color rojo, el segundo **byte** representa la intensidad del color verde, y el **byte** menos significativo representa la intensidad del color azul. En la Figura 2, los **bits** menos significativos de los componentes rojo, verde y azul de los dos píxeles son diferentes, sin embargo, ambos píxeles se ven del mismo color. El píxel de la derecha es el resultado de codificar el mensaje de tres bits `011` en los bits menos significativos de cada color en el píxel original. Esto es, codificar el `0` en el bit menos significativo del componente rojo, codificar el `1` en el bit menos significativo del componente verde, y  codificar el `1` en el bit menos significativo del componente azul del píxel.
143
+
144
+---
145
+
146
+![figure2.png](images/figure2.png)
147
+
148
+**Figura 2.** El cuadrado de la izquierda representa un píxel de color `0xff0000`. El cuadrado de la derecha representa un píxel de color `0xfe0101`.
149
+
150
+---
151
+
152
+Ahora ilustraremos el procedimiento para empotrar la palabra en inglés "Dog" en la siguiente imagen:
153
+
154
+
155
+![main3.png](images/main3.png)
156
+
157
+Asume que cada cuadrado es un píxel de la imagen.
158
+
159
+El primer paso sería obtener la representación ASCII del mensaje. Los bits de la representación ASCII son los bits que codificaremos en los colores de los píxeles. La representación ASCII de "Dog" es:
160
+
161
+
162
+```
163
+"Dog"  = 01000100 01101111 01100111
164
+```
165
+
166
+El código `01000100` corresponde a la `D`, y así sucesivamente.
167
+
168
+El proceso de codificación es más fácil de entender si separamos los bits en grupos de tres (un bit por cada componente del RGB):
169
+
170
+```
171
+"Dog"  = 010 001 000 110 111 101 100 111
172
+```
173
+
174
+Ahora, comenzamos a recorrer la imagen píxel por píxel, empotrando en cada píxel tres bits del código ASCII (un bit en cada componente de color del píxel). Por ejemplo, empotraríamos  `010` en el primer píxel, `001` en el segundo, y así sucesivamente.
175
+
176
+Podemos hacer lo siguiente para empotrar cada trío de bits  `b2, b1, b0`:
177
+
178
+```
179
+Datos de entrada: p: un píxel 
180
+    b2,b1,b0: el trío de bits
181
+Dato de salida: modifiedPixel: el píxel con el trío empotrado
182
+========
183
+1. r = componente rojo de p 
184
+2. g = componente verde de p
185
+3. b = componente azul de p
186
+4. "limpiar" o apagar" los bits menos significativos de r,g,b
187
+5. el componente rojo de modifiedPixel contendrá b2 sustituido en el bit menos significativo de r
188
+6. el componente verde de modifiedPixel contendrá b1 sustituido en el bit menos significativo de g
189
+7. el componente azul de modifiedPixel contendrá b0 sustituido en el bit menos significativo de b
190
+
191
+```
192
+
193
+
194
+Por ejemplo, digamos que queremos empotrar el trío `011` en el píxel cuyo código de color es `0xa5b6c7`. El algoritmo computará como sigue:
195
+
196
+
197
+```
198
+1. r = 0x10100101  // esto es 0xa5
199
+2. g = 0x10110110  // esto es 0xb6
200
+3. b = 0x11000111  // esto es 0xc7
201
+4. "limpiar" los bits menos significativos de r,g,b
202
+   r será 0x10100100
203
+   g será 0x10110110
204
+   b será 0x11000110
205
+5. el componente rojo de modifiedPixel será 0x10100100 (esto es, 0xa4)
206
+6. el componente verde de modifiedPixel será 0x10110111 (esto es 0xb7)
207
+7. el componente azul de modifiedPixel será 0x11000111 (esto es 0xc7)
208
+
209
+el código del color de modifiedPixel será 0xa4b7c7
210
+```
211
+
212
+La siguiente es la imagen después que la palabra "Dog" fue empotrada.
213
+
214
+![figure3.png](images/figure3.png)
215
+
216
+Solo el color de los primeros 8 píxeles fue modificado, ya que el código ASCII para todas las letras en la palabra "Dog" tiene 24 bits de largo.
217
+
218
+Los siguientes son los códigos de los colores de los primeros ocho píxeles de la imagen original y de la imagen modificada.
219
+
220
+
221
+
222
+
223
+|  Píxel de la imagen original  |  Trío de bits  |  Píxel de la imagen modificada |
224
+|---|---|---|
225
+| `0x99 99 99` | `010`  | `0x98 99 98`  |
226
+| `0x00 00 00` | `001`  | `0x00 00 01`  |
227
+| `0x00 00 00` | `000`  | `0x00 00 00`  |
228
+| `0x00 00 00` | `110`  | `0x01 01 00`  |
229
+| `0x00 00 00` | `111`  | `0x01 01 01`  |
230
+| `0x00 00 00` | `101`  | `0x01 00 01`  |
231
+| `0x00 00 00` | `100`  | `0x01 00 00`  |
232
+| `0x00 00 00` | `111`  | `0x01 01 01`  |
233
+
234
+
235
+Pregunta: 
236
+¿Qué mensaje está escondido (usando la técnica del bit menos significativo) en una imagen cuyos primeros 8 píxeles son:
237
+
238
+
239
+```
240
+0x545554 0x666667 0x444544 0x333232
241
+0xff0000 0x0100ff 0x00ff00 0x10aaba 
242
+```
243
+
244
+Explica tu respuesta.
245
+
246
+---
247
+
248
+---
249
+
250
+##Sesión de laboratorio:
251
+
252
+En la experiencia de laboratorio de hoy completarás una aplicación de esteganografía para extraer mensajes ocultos en imágenes.
253
+
254
+###Ejercicio 1: Extraer el mensaje binario
255
+
256
+####Instrucciones
257
+
258
+
259
+1. Carga a QtCreator el proyecto `Steganography` haciendo doble "click" en el archivo `Steganography.pro` en el directorio `Documents/eip/Repetitions-Steganography` de tu computadora. También puedes ir a `http://bitbucket.org/eip-uprrp/repetitions-steganography` para descargar la carpeta `Repetitions-Steganography` a tu computadora.
260
+ 
261
+
262
+    El proyecto contiene el esqueleto de una aplicación para recuperar mensajes empotrados en imágenes. Los mensajes que estarás recobrando se empotraron utilizando la técnica del bit menos significativo. El final de cada mensaje se codificó utilizando el caracter ASCII con código binario `00000000`.
263
+
264
+2. Compila y corre el programa. Debes obtener una interface que luce parecida a:
265
+
266
+    ![img1.png](images/img1.png)
267
+
268
+3. El botón `Load Image` fue programado para permitir al usuario cargar una imagen y desplegarla. Tu tarea es programar la funcionalidad del botón `Retrieve Message` para analizar la imagen y extraer el mensaje escondido. El mensaje escondido debe desplegarse en la ventana que dice `Write a message`.
269
+
270
+4. Estarás trabajando con el archivo `steganography.cpp`. Completa la función `ExtractMessage` que recibe una imagen de esteganografía para que extraiga los dígitos del mensaje binario empotrado en la imagen y los guarde en un "string". La función debe invocar otra función `binaryStringToMessage` que convierta el "string" de `0`'s y `1`'s en los caracteres del mensaje y devolver el mensaje oculto.
271
+
272
+    Por ejemplo, si los primeros píxeles de la imagen fuesen los siguientes,
273
+
274
+    ````
275
+    0x98 99 98 0x00 00 01 0x00 00 00 0x01 01 00 
276
+    0x01 01 01 0x01 00 01 0x01 00 00 0x01 01 01
277
+    0xf0 ea 00 0x44 00 f0 0x00 aa 22 . . . .,
278
+    ````
279
+
280
+    tu función `ExtractMessage` extraería los bits menos significativos de cada componente de color construiría el siguiente `string`: `”010001000110111101100111000000000…”`.
281
+
282
+    Nota que tu algoritmo debe tener algún mecanismo para detectar si el último bloque de 8 caracteres extraídos eran todos `0`. Cuando esto pase, el algoritmo debe parar de leer los píxeles.
283
+
284
+    El “string” de dígitos binarios debe ser enviado a otra función `binaryStringToMessage` (ver Ejercicio 2) que interprete los `0`'s  y `1`'s como los bits de caracteres ASCII. En el ejemplo, si pasaras  el argumento `”010001000110111101100111000000000”` a la función  `binaryStringToMessage`, debería devolver "Dog" (porque `01000100` corresponde a `D`, `01101111` es 'o',  `01100111` es 'g', y un `00000000` simboliza que se terminó el “string”.)
285
+
286
+Para poder implementar el algoritmo de extracción del mensaje, debes entender cómo fue empotrado el mensaje. Si es necesario, repasa la sección “Empotrando un mensaje en una imagen”.
287
+
288
+
289
+###Ejercicio 2: Interpretar el mensaje
290
+
291
+####Instrucciones
292
+
293
+
294
+1. Completa la función `binaryStringToMessage` que recibe el "string" de `0`'s y `1`'s extraido de la imagen para que devuelva el mensaje oculto. Puedes aprovechar la función `binStringToChar` para convertir "substrings" de 8 `0`'s y `1`'s en el caracter que le corresponde.
295
+
296
+2. Prueba tu código usando las siguientes imágenes
297
+
298
+    * `pug.png`, contiene el mensaje "Hello World !"
299
+    * `uprTorre.png`, contiene el mensaje "CCOM3033 - Steganography Lab Rules!!!"
300
+
301
+3. Una vez que valides tu código con las imágenes de prueba, usa el programa para analizar las siguientes imágenes:
302
+
303
+    * `gallito.png`
304
+    * `puppy.png`
305
+    * `vacas.png`
306
+
307
+
308
+---
309
+
310
+---
311
+
312
+##Entrega
313
+
314
+Utiliza "Entrega" en Moodle para entregar el archivo `steganography.cpp` que contiene las funciones `ExtractMessage` y `binaryStringToMessage`. Recuerda utilizar buenas prácticas de programación, incluir el nombre de los programadores y documentar tu programa.
315
+
316
+
317
+---
318
+
319
+---
320
+
321
+
322
+## Referencias
323
+
324
+[1] Rocha, Anderson, and Siome Goldenstein. "Steganography and steganalysis in digital multimedia: Hype or hallelujah?." Revista de Informática Teórica e Aplicada 15.1 (2008): 83-110.
325
+
326
+---
327
+
328
+---
329
+
330
+---
331
+
332
+[English](#markdown-header-repetition-structures-steganography) | [Español](#markdown-header-estructuras-de-repeticion-esteganografia)
333
+
334
+# Repetition Structures - Steganography
335
+
336
+![main1.png](images/main1.png)
337
+![main2.png](images/main2.png)
338
+![main3.png](images/main3.png)
339
+
340
+One of the advantages of using computer programs is that we can easily implement repetitive tasks. Structures such as the `for`, `while`, and `do-while` allow us to repeat a block of instructions as many times as needed. These structures are also referred to as *repetition structures*. In today's laboratory experience you will complete a steganography application to practice the use of nested loops and the manipulation of bidimensional arrays.
341
+
342
+##Objectives:
343
+
344
+1. Apply nested loops and decision structures to manipulate bidimensional arrays and extract messages hidden in images.
345
+
346
+2. Use modular programming.
347
+
348
+3. Use the binary representation of characters.
349
+
350
+
351
+##Pre-Lab:
352
+
353
+Before coming to the laboratory session you should have:
354
+
355
+1. Reviewed the basic concepts related to repetition structures, bidimensional arrays and decision structures.
356
+
357
+2. Studied the concepts of the color composition of pixels in images.
358
+
359
+3. Studied the binary representation of characters.
360
+
361
+4. Reviewed the string manipulation methods.
362
+
363
+5. Studied the concepts and instructions related to the laboratory session.
364
+
365
+6. Taken the Pre-Lab quiz available through the course’s Moodle portal.
366
+
367
+---
368
+
369
+---
370
+
371
+
372
+##Steganography
373
+
374
+Steganography is the science of camouflaging the presence of hidden messages in legitimate carriers (seemingly harmless files). This science has been used by cybercriminals to inflict damage to computer systems and by (old style) terrorists to encode hidden messages transmitted through the internet. There is claim that Al-Qaeda may have used steganography to encode messages into images, and then transport them via e-mail, and possibly via USENET, to prepare and execute the September 11,  2001 terrorist attack. 
375
+
376
+Steganography has some lawful uses too [1]:
377
+
378
+* A medical imaging laboratory can embed a patient's information into the images, thus preventing against fraud and/or patient misdiagnosis. 
379
+* We can use hidden information to identify the legitimate owner of a document or image. If the document is leaked, or distributed to unauthorized parties, one can trace it back to the rightful owner and perhaps discover which party broke the license distribution agreement.
380
+
381
+In this laboratory experience you will implement a simple algorithm to extract hidden messages from steganography images.
382
+
383
+---
384
+
385
+##Image Editing
386
+
387
+In this laboratory experience, you will recover secret messages that have been hidden in an image. To be able to carry out your task, you should understand some concepts related to images, be familiar with the methods of the `QImage` class in `Qt`,  and with functions to work with data of the `QRgb` type.
388
+
389
+###Pixels
390
+
391
+The smallest element in an image is called a *pixel*. This unit consists of a single color. Since each color is a combination of tones for the primary red, green and blue colors, it is coded as an unsigned integer whose bytes represent the tones of red, green and blue of the pixel (Figure 1). This combination is called the color's *RGB* which is an acronym for "Red-Green-Blue". For example, a pure red pixel has an RGB representation of `0x00ff0000`, while a white pixel has an RGB representation of `0x00FFFFFF` (since the color white is a combination of tones of red, green and blue in all of their intensity).
392
+
393
+---
394
+
395
+![figure1.png](images/figure1.png)
396
+
397
+**Figure 1.** Bit distribution for the tones of red, green and blue in an RGB representation. Each tone can have values between 0x00 (the eight bits in 0) and 0xFF (the 8 bits in 1).
398
+
399
+---
400
+
401
+`Qt` uses the `QRgb` type to represent `RGB` values. Using the functions that are described below we can perform important operations to analyze images, such as obtaining the RGB of each pixel in an image, and to obtain the red, green and blue components of the `QRgb` value of the pixel.
402
+
403
+###Library
404
+
405
+In today's laboratory experience you will use the `QImage` class. This class allows you to access the data in the pixels of an image to manipulate it. The documentation for the `QImage` class can be found in http://doc.qt.io/qt-4.8/qimage.html.
406
+
407
+The code provided in the file  `steganography.cpp`  contains the following objects of the `QImage` class:
408
+
409
+* `origImage`   // contains the information of the original image where the message was hidden
410
+*  `newImage`  // will contain the image with the hidden message
411
+
412
+The objects of the `QImage` class have the following methods that will be useful for today's laboratory experience:
413
+
414
+* `width()`      // returns the positive integer value for the image's width 
415
+* `height()`      // returns the positive integer value for the image's height 
416
+* `pixel(i, j)`       // returns the `QRgb` for the pixel in position `(i,j)`
417
+
418
+
419
+The following functions are useful to work with data of type `QRgb`:
420
+
421
+* `qRed(pixel)`   // returns the tone for the pixel's red color, i.e. a value between (0x00 and 0xFF)
422
+* `qGreen(pixel)` // returns the tone for the pixel's green color, i.e. a value between (0x00 and 0xFF)
423
+* `qBlue(pixel)`  // returns the tone for the pixel's blue color, i.e. a value between (0x00 and 0xFF)
424
+
425
+
426
+
427
+####Examples:
428
+
429
+1. If the following `4 x 4` image of pixels represents the object `origImage`,
430
+
431
+    ![ejemplo.png](images/ejemplo.png)
432
+
433
+then `origImage.pixel(2,1)` returns the `rgb` value that represents the color blue ( `0x0000ff`).
434
+
435
+2. The following instruction assigns to `greenContent` the value of the green tone that is contained in the pixel `(1,1)` of `origImage`:
436
+
437
+    `int greenContent = qGreen(origImage.pixel(1,1));`.
438
+
439
+3. The following program creates an object of class `QImage`  and prints the red, green and blue components of the pixel in the center of the image. The image used is the one specified within the parenthesis during the creation of the object, that is, the file `chuck.png`.
440
+
441
+---
442
+
443
+```cpp
444
+#include <QImage>
445
+#include <iostream>
446
+
447
+using namespace std;
448
+int main() {
449
+    QImage myImage(“/Users/rarce/Downloads/chuck.png”);
450
+    QRgb    centralPixel;
451
+
452
+    centralPixel = myImage.pixel(myImage.width() / 2, myImage.height() / 2);
453
+
454
+    cout    << hex;
455
+
456
+    cout    << “The red, green and blue components of the middle pixel are: “
457
+        << qRed(centralPixel) << “, “
458
+        << qGreen(centralPixel) << “, “
459
+        << qBlue(centralPixel) << endl;
460
+    return 0;
461
+}
462
+```
463
+
464
+---
465
+
466
+
467
+###Embedding a message into an image
468
+
469
+One of the simplest methods of *hidding* a message in an image is by encoding the message into the least significant bits of the image pixel's colors. This method effectively hides the message in the image because changing the least significant bit of a 8-bit color is barely noticeable by the human observer.  
470
+
471
+For example, Figure 2 shows two huge pixels, the one on the left has color `0xff0000` and the one on the right has color `0xfe0101`. Recall that the most significant **byte** (i.e. the two leftmost hex digits) represents the intensity of the red color, the second **byte** represents the intensity of the green color, and the least significant **byte** represents the intensity of the blue color. In Figure 2, the least significant **bits** of the red, green and blue components of the two pixels are different, yet, they look the same color. The pixel on the right is the result of encoding the three bit message `011` into the original pixel's least significant bits (of each color). That is, encode the `0` in the least significant bit of the red component, encode the `1` in the least significant bit of the green component, and encode the `1` in the least significant bit of the blue component in the pixel.
472
+
473
+---
474
+
475
+![figure2.png](images/figure2.png)
476
+
477
+**Figure 2.** The left square represents a pixel of color `0xff0000`. The right square represents a pixel of color `0xfe0101`.
478
+
479
+---
480
+
481
+
482
+Let's illustrate the embedding procedure of the word "Dog" into the following image:
483
+
484
+![main3.png](images/main3.png)
485
+
486
+Assume that each square is a pixel of the image. 
487
+
488
+The first step would be to obtain the ASCII representation of the message. The bits of the ASCII representation are the bits we will encode into the colors of the pixels. The ASCII representation of `Dog` is:
489
+
490
+```
491
+"Dog"  = 01000100 01101111 01100111
492
+```
493
+
494
+The code `0100 0100` corresponds to the `D`, and so forth.
495
+
496
+The encoding procedure it is easier to understand if we separate the bits into groups of three (one bit for each RGB component):
497
+
498
+```
499
+"Dog"  = 010 001 000 110 111 101 100 111
500
+```
501
+
502
+Next, we start traversing the image pixel by pixel, embedding in each pixel three bits from the ASCII code (one bit in each pixel's color component). For instance, we would embed `010` in the first pixel, `001` in the second, and so forth.
503
+
504
+We may do the following to embed each trio of bits `b2, b1, b0`:
505
+
506
+```
507
+Input: p: a pixel
508
+b2,b1,b0: the trio of bits
509
+Output: modifiedPixel: the pixel with the embedded trio
510
+========
511
+1. r = red component of p 
512
+2. g = green component of p
513
+3. b = blue component of p
514
+4. clear the least significant bits of r,g,b
515
+5. the red component of modifiedPixel will contain b2 substituted in the least significant bit of r
516
+6. the green component of modifiedPixel will contain b1 substituted in the least significant bit of g
517
+7. the blue component of modifiedPixel will contain b0 substituted in the least significant bit of b
518
+```
519
+
520
+For example, say that you are embedding the bit trio `011` into a pixel whose color code is `0xa5b6c7`. The algorithm would compute as follows:
521
+
522
+
523
+```
524
+1. r = 0x10100101  // this is 0xa5
525
+2. g = 0x10110110  // this is 0xb6
526
+3. b = 0x11000111  // this is 0xc7
527
+4. clear the least significant bits of r,g,b
528
+   r becomes 0x10100100
529
+   g becomes 0x10110110
530
+   b becomes 0x11000110
531
+5. the red component of the modifiedPixel will be 0x10100100 (that is, 0xa4)
532
+6. the green component of the modifiedPixel will be 0x10110111 (that is 0xb7)
533
+7. the blue component of the modifiedPixel will be 0x11000111 (that is 0xc7)
534
+
535
+the modifiedPixel color code will be 0xa4b7c7
536
+```
537
+
538
+The following is the image after the word "Dog" was embedded.
539
+
540
+![figure3.png](images/figure3.png)
541
+
542
+Only the color of the first 8 pixels was modified, since the combined ASCII code for "Dog" was 24 bits long.
543
+
544
+The following are the color codes for first eight pixels of the original and modified images:
545
+
546
+
547
+
548
+|  Original Image pixel  |  Bit trio  |  Modified image pixel |
549
+|---|---|---|
550
+| `0x99 99 99` | `010`  | `0x98 99 98`  |
551
+| `0x00 00 00` | `001`  | `0x00 00 01`  |
552
+| `0x00 00 00` | `000`  | `0x00 00 00`  |
553
+| `0x00 00 00` | `110`  | `0x01 01 00`  |
554
+| `0x00 00 00` | `111`  | `0x01 01 01`  |
555
+| `0x00 00 00` | `101`  | `0x01 00 01`  |
556
+| `0x00 00 00` | `100`  | `0x01 00 00`  |
557
+| `0x00 00 00` | `111`  | `0x01 01 01`  |
558
+
559
+
560
+Question: 
561
+What message is hidden (using the least significant bit technique) in an image whose first 8 pixels are:
562
+
563
+```
564
+0x545554 0x666667 0x444544 0x333232
565
+0xff0000 0x0100ff 0x00ff00 0x10aaba 
566
+```
567
+
568
+Explain your answer.
569
+
570
+---
571
+
572
+---
573
+
574
+##Laboratory Session
575
+
576
+In today's laboratory experience you will complete a steganography application to extract hidden messages from images.
577
+
578
+###Exercise 1: Extract the binary message
579
+
580
+####Instructions
581
+
582
+1. Load the Qt project called `Steganography` by double-clicking on the `Steganography.pro` file in the `Documents/eip/Repetitions-Steganography` folder of your computer. You can also go to `http://bitbucket.org/eip-uprrp/repetitions-steganography` to download the `Repetitions-Steganography` folder to your computer.
583
+
584
+The project contains the skeleton for an application to recover embedded messages from images. The messages that you will be recovering have been  embedded using the least significant bit technique. The end of each message was encoded by using the ASCII character with binary code `00000000`. 
585
+
586
+2. Compile and run the program. You should obtain an interface that looks similar to:
587
+
588
+![img1.png](images/img1.png)
589
+
590
+3. The button `Load Image` has already been programmed to allow the user to load an image and display it. Your task is to program the functionality of the button `Retrieve Message` to analyze the image and extract the hidden message. The hidden message should be displayed in the `Write a message` window.
591
+
592
+4. You will be working with the `steganography.cpp` file. Complete the `ExtractMessage` function that receives a steganography image so it extracts the digits of the binary message encoded in the image and stores them in a string. The function should invoke another function `binaryStringToMessage` that converts the string from `0`'s and `1`'s in the message's characters and returns the hidden message.
593
+
594
+
595
+For example, if the first few pixels the image were these:
596
+
597
+````
598
+0x98 99 98 0x00 00 01 0x00 00 00 0x01 01 00 
599
+0x01 01 01 0x01 00 01 0x01 00 00 0x01 01 01
600
+0xf0 ea 00 0x44 00 f0 0x00 aa 22 . . . .
601
+````
602
+
603
+your `ExtractMessage` function would extract the least significant bits of each colors component and construct the `string`: `"010001000110111101100111000000000.."`.
604
+
605
+Notice that your algorithm should have some mechanism for detecting if the last 8 character block were all `0`. When this happens, the algorithm should stop reading the pixels.
606
+
607
+The string of binary digits should then be sent to another function `binaryStringToMessage` (see Exercise 2) that interprets the `0`'s and `1`'s as the bits of ASCII characters. In the example, the string `”010001000110111101100111000000000”` would be decoded to "Dog"
608
+(because `01000100` corresponds to 'D', `01101111` is 'o',  `01100111` is 'g', and a `00000000` symbolizes the end of the string.)
609
+
610
+To implement the algorithm for extracting the message, you should understand how the message was encoded. If necessary, review the "Embedding a message into an image" section.
611
+
612
+
613
+###Exercise 2: Interpreting the message
614
+
615
+
616
+####Instructions
617
+
618
+1. Complete the `binaryStringToMessage` function that receives the string of `0`'s and `1`'s extracted from the image so it returns the hidden message. You can use the `binStringToChar` function to convert substrings of 8 `0`'s and `1`'s in its corresponding character.
619
+
620
+2. Test your code using the following images:
621
+
622
+    * `pug.png`, contains the message "Hello World !"
623
+    * `uprTorre.png`, contains the message "CCOM3033 - Steganography Lab Rules!!!"
624
+
625
+3. Once you validate your program using the test images, use the program to analyze the following images. 
626
+
627
+    * `gallito.png`
628
+    * `puppy.png`
629
+    * `vacas.png`
630
+
631
+
632
+---
633
+
634
+---
635
+
636
+##Deliverables
637
+
638
+Use "Deliverables" in Moodle to upload the `steganography.cpp` file that contains the `ExtractMessage` and `binaryStringToMessage` functions. Remember to use good programming techniques, include the names of the programmers involved, and to document your program.
639
+
640
+---
641
+
642
+---
643
+
644
+
645
+##References 
646
+
647
+[1] Rocha, Anderson, and Siome Goldenstein. "Steganography and steganalysis in digital multimedia: Hype or hallelujah?." Revista de Informática Teórica e Aplicada 15.1 (2008): 83-110.

+ 106
- 0
StegaPanel.cpp View File

@@ -0,0 +1,106 @@
1
+// RAN - 2014/06/10 : Clear the textEdit control image is loaded.
2
+
3
+#include "StegaPanel.h"
4
+#include "ui_StegaPanel.h"
5
+#include <QtDebug>
6
+#include <QLabel>
7
+#include "steganography.h"
8
+
9
+StegaPanel::StegaPanel(QWidget *parent) :
10
+    QMainWindow(parent),
11
+    ui(new Ui::StegaPanel)
12
+{
13
+    leastBits = 1; //initialize to 1 bits used in pixel for message
14
+    ui->setupUi(this); //
15
+
16
+}
17
+
18
+
19
+void StegaPanel::hideMessage()
20
+{
21
+
22
+    string binMsg ;         // Will be used to store the message in a binary String format
23
+
24
+    ui->error_msg_label->clear(); //clear error text
25
+    orig_msg = ui->textEdit->toPlainText(); //obtain msg from textEdit
26
+    leastBits = ui->bitBox->value(); //get number of least significant bits to use for msg
27
+
28
+    if(old_image.isNull()){
29
+        qDebug() << "Load an image first!";
30
+        ui->error_msg_label->setText("NO IMAGE LOADED!");
31
+    }
32
+    else if (orig_msg == NULL){
33
+        ui->error_msg_label->setText("No message to hide!");
34
+    }
35
+    else{
36
+
37
+        binMsg = messageToBinaryString(orig_msg.toStdString(), leastBits) ;
38
+
39
+        if(((old_image.width() * old_image.height()) * 3 * leastBits) < binMsg.length())
40
+        {
41
+            ui->error_msg_label->setText("IMAGE NOT BIG ENOUGH FOR MESSAGE!");
42
+        }
43
+        else
44
+        {
45
+            EmbbedMessage(old_image, new_image, orig_msg.toStdString(), leastBits) ;
46
+        }
47
+
48
+        ui->error_msg_label->setText("Message hidden in Stego Image with " + QString::number(leastBits) + " stego bits.");
49
+    }
50
+}
51
+
52
+void StegaPanel::revealMessage()
53
+{
54
+
55
+    string msg = ExtractMessage(new_image, ui->bitBox->value()) ;
56
+
57
+    if (msg.length() > 0){
58
+        ui->textEdit->setText(QString::fromStdString(msg));
59
+        ui->error_msg_label->setText("Message extracted!");
60
+    }
61
+    else{
62
+        ui->error_msg_label->setText("Could not extract message!");
63
+    }
64
+}
65
+
66
+void StegaPanel::on_loadImage_clicked()
67
+{
68
+    QString fname = QFileDialog::getOpenFileName(this, tr("Choose an image"), QDir::homePath());
69
+        if (!fname.isEmpty()){
70
+            QImage image(fname);
71
+            if (image.isNull())
72
+                QMessageBox::information(this, tr("Choose an image"),tr("Cannot load %1.").arg(fname));
73
+            old_image=image;
74
+            new_image=image;
75
+            repaint();
76
+        }
77
+        ui->old_image->setPixmap(QPixmap::fromImage(old_image));
78
+        ui->new_image->setPixmap(QPixmap::fromImage(new_image));
79
+        ui->textEdit->setText("");
80
+        ui->error_msg_label->setText("Image loaded!");
81
+}
82
+
83
+void StegaPanel::on_hideMessage_clicked()
84
+{
85
+    hideMessage();
86
+    ui->new_image->setPixmap(QPixmap::fromImage(new_image));
87
+}
88
+
89
+void StegaPanel::on_getMessage_clicked()
90
+{
91
+    revealMessage();
92
+}
93
+
94
+
95
+StegaPanel::~StegaPanel()
96
+{
97
+    delete ui;
98
+}
99
+
100
+void StegaPanel::on_storeImage_clicked()
101
+{
102
+    QPixmap out = QPixmap::grabWidget(this,361,10,481,481);
103
+    QString fname = QFileDialog::getSaveFileName(this, tr("Save Edited Image"), (""), tr("PNG (*.png)" ));
104
+    new_image.save(fname, "PNG");
105
+    ui->error_msg_label->setText("Image saved to" + fname + " !");
106
+}

+ 45
- 0
StegaPanel.h View File

@@ -0,0 +1,45 @@
1
+#ifndef STEGAPANEL_H
2
+#define STEGAPANEL_H
3
+
4
+#include <QMainWindow>
5
+#include <QFileDialog>
6
+#include <QDir>
7
+#include <QMessageBox>
8
+#include <QSlider>
9
+#include <QShortcut>
10
+#include <QMessageBox>
11
+#include <string>
12
+
13
+using namespace std ;
14
+
15
+namespace Ui {
16
+class StegaPanel;
17
+}
18
+
19
+class StegaPanel : public QMainWindow
20
+{
21
+    Q_OBJECT
22
+
23
+public:
24
+    explicit StegaPanel(QWidget *parent = 0);
25
+    void hideMessage();
26
+    void revealMessage();
27
+    ~StegaPanel();
28
+
29
+private slots:
30
+    void on_loadImage_clicked();
31
+    void on_hideMessage_clicked();
32
+    void on_getMessage_clicked();
33
+
34
+    void on_storeImage_clicked();
35
+
36
+private:
37
+    Ui::StegaPanel *ui;
38
+    QImage old_image;
39
+    QImage new_image;
40
+    int leastBits; //number of bits used in pixel for message
41
+    QString orig_msg;
42
+
43
+};
44
+
45
+#endif // MAINWINDOW_H

+ 241
- 0
StegaPanel.ui View File

@@ -0,0 +1,241 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<ui version="4.0">
3
+ <class>StegaPanel</class>
4
+ <widget class="QMainWindow" name="StegaPanel">
5
+  <property name="geometry">
6
+   <rect>
7
+    <x>0</x>
8
+    <y>0</y>
9
+    <width>1055</width>
10
+    <height>625</height>
11
+   </rect>
12
+  </property>
13
+  <property name="windowTitle">
14
+   <string>Steganography</string>
15
+  </property>
16
+  <widget class="QWidget" name="centralWidget">
17
+   <widget class="QLabel" name="old_label">
18
+    <property name="geometry">
19
+     <rect>
20
+      <x>220</x>
21
+      <y>10</y>
22
+      <width>91</width>
23
+      <height>21</height>
24
+     </rect>
25
+    </property>
26
+    <property name="text">
27
+     <string>Original Image</string>
28
+    </property>
29
+   </widget>
30
+   <widget class="QLabel" name="new_label">
31
+    <property name="geometry">
32
+     <rect>
33
+      <x>750</x>
34
+      <y>10</y>
35
+      <width>81</width>
36
+      <height>16</height>
37
+     </rect>
38
+    </property>
39
+    <property name="text">
40
+     <string>Stego Image</string>
41
+    </property>
42
+   </widget>
43
+   <widget class="QLabel" name="old_image">
44
+    <property name="geometry">
45
+     <rect>
46
+      <x>20</x>
47
+      <y>40</y>
48
+      <width>501</width>
49
+      <height>401</height>
50
+     </rect>
51
+    </property>
52
+    <property name="baseSize">
53
+     <size>
54
+      <width>0</width>
55
+      <height>0</height>
56
+     </size>
57
+    </property>
58
+    <property name="frameShape">
59
+     <enum>QFrame::StyledPanel</enum>
60
+    </property>
61
+    <property name="text">
62
+     <string/>
63
+    </property>
64
+    <property name="scaledContents">
65
+     <bool>true</bool>
66
+    </property>
67
+   </widget>
68
+   <widget class="QLabel" name="new_image">
69
+    <property name="geometry">
70
+     <rect>
71
+      <x>540</x>
72
+      <y>40</y>
73
+      <width>501</width>
74
+      <height>401</height>
75
+     </rect>
76
+    </property>
77
+    <property name="frameShape">
78
+     <enum>QFrame::StyledPanel</enum>
79
+    </property>
80
+    <property name="text">
81
+     <string/>
82
+    </property>
83
+    <property name="scaledContents">
84
+     <bool>true</bool>
85
+    </property>
86
+   </widget>
87
+   <widget class="QTextEdit" name="textEdit">
88
+    <property name="geometry">
89
+     <rect>
90
+      <x>310</x>
91
+      <y>460</y>
92
+      <width>411</width>
93
+      <height>91</height>
94
+     </rect>
95
+    </property>
96
+    <property name="html">
97
+     <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
98
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
99
+p, li { white-space: pre-wrap; }
100
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
101
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
102
+    </property>
103
+   </widget>
104
+   <widget class="QLabel" name="error_msg_label">
105
+    <property name="geometry">
106
+     <rect>
107
+      <x>250</x>
108
+      <y>571</y>
109
+      <width>581</width>
110
+      <height>20</height>
111
+     </rect>
112
+    </property>
113
+    <property name="text">
114
+     <string/>
115
+    </property>
116
+   </widget>
117
+   <widget class="QWidget" name="layoutWidget">
118
+    <property name="geometry">
119
+     <rect>
120
+      <x>77</x>
121
+      <y>460</y>
122
+      <width>171</width>
123
+      <height>66</height>
124
+     </rect>
125
+    </property>
126
+    <layout class="QVBoxLayout" name="verticalLayout">
127
+     <item>
128
+      <widget class="QPushButton" name="loadImage">
129
+       <property name="text">
130
+        <string>Load Image</string>
131
+       </property>
132
+      </widget>
133
+     </item>
134
+     <item>
135
+      <widget class="QPushButton" name="storeImage">
136
+       <property name="text">
137
+        <string>Store New Image</string>
138
+       </property>
139
+      </widget>
140
+     </item>
141
+    </layout>
142
+   </widget>
143
+   <widget class="QWidget" name="verticalLayoutWidget">
144
+    <property name="geometry">
145
+     <rect>
146
+      <x>760</x>
147
+      <y>460</y>
148
+      <width>181</width>
149
+      <height>106</height>
150
+     </rect>
151
+    </property>
152
+    <layout class="QVBoxLayout" name="verticalLayout_3">
153
+     <item>
154
+      <layout class="QHBoxLayout" name="horizontalLayout_2">
155
+       <item>
156
+        <widget class="QLabel" name="label">
157
+         <property name="text">
158
+          <string>Number of Bits :</string>
159
+         </property>
160
+        </widget>
161
+       </item>
162
+       <item>
163
+        <widget class="QSpinBox" name="bitBox">
164
+         <property name="minimum">
165
+          <number>1</number>
166
+         </property>
167
+         <property name="maximum">
168
+          <number>8</number>
169
+         </property>
170
+        </widget>
171
+       </item>
172
+      </layout>
173
+     </item>
174
+     <item>
175
+      <widget class="QPushButton" name="hideMessage">
176
+       <property name="text">
177
+        <string>Hide Message</string>
178
+       </property>
179
+      </widget>
180
+     </item>
181
+     <item>
182
+      <widget class="QPushButton" name="getMessage">
183
+       <property name="text">
184
+        <string>Retrieve Message</string>
185
+       </property>
186
+      </widget>
187
+     </item>
188
+    </layout>
189
+   </widget>
190
+   <widget class="QLabel" name="label_3">
191
+    <property name="geometry">
192
+     <rect>
193
+      <x>800</x>
194
+      <y>550</y>
195
+      <width>99</width>
196
+      <height>29</height>
197
+     </rect>
198
+    </property>
199
+    <property name="font">
200
+     <font>
201
+      <pointsize>9</pointsize>
202
+     </font>
203
+    </property>
204
+    <property name="text">
205
+     <string>(from Original Image)</string>
206
+    </property>
207
+   </widget>
208
+   <zorder>layoutWidget</zorder>
209
+   <zorder>old_label</zorder>
210
+   <zorder>new_label</zorder>
211
+   <zorder>old_image</zorder>
212
+   <zorder>new_image</zorder>
213
+   <zorder>textEdit</zorder>
214
+   <zorder>error_msg_label</zorder>
215
+   <zorder>verticalLayoutWidget</zorder>
216
+   <zorder>label_3</zorder>
217
+  </widget>
218
+  <widget class="QMenuBar" name="menuBar">
219
+   <property name="geometry">
220
+    <rect>
221
+     <x>0</x>
222
+     <y>0</y>
223
+     <width>1055</width>
224
+     <height>22</height>
225
+    </rect>
226
+   </property>
227
+  </widget>
228
+  <widget class="QToolBar" name="mainToolBar">
229
+   <attribute name="toolBarArea">
230
+    <enum>TopToolBarArea</enum>
231
+   </attribute>
232
+   <attribute name="toolBarBreak">
233
+    <bool>false</bool>
234
+   </attribute>
235
+  </widget>
236
+  <widget class="QStatusBar" name="statusBar"/>
237
+ </widget>
238
+ <layoutdefault spacing="6" margin="11"/>
239
+ <resources/>
240
+ <connections/>
241
+</ui>

+ 25
- 0
Steganography.pro View File

@@ -0,0 +1,25 @@
1
+#-------------------------------------------------
2
+#
3
+# Project created by QtCreator 2014-10-03T09:43:48
4
+#
5
+#-------------------------------------------------
6
+
7
+QT       += core gui
8
+
9
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
10
+
11
+TARGET = steganography
12
+TEMPLATE = app
13
+
14
+
15
+SOURCES += main.cpp\
16
+        mainwindow.cpp \
17
+    steganography.cpp
18
+
19
+HEADERS  += mainwindow.h \
20
+    steganography.h
21
+
22
+FORMS    += mainwindow.ui
23
+
24
+RESOURCES += \
25
+    images.qrc

+ 271
- 0
Steganography.pro.user View File

@@ -0,0 +1,271 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE QtCreatorProject>
3
+<!-- Written by QtCreator 3.4.0, 2015-08-11T11:35:52. -->
4
+<qtcreator>
5
+ <data>
6
+  <variable>EnvironmentId</variable>
7
+  <value type="QByteArray">{927fb263-722b-46dd-b3ec-8bedf75b6ed1}</value>
8
+ </data>
9
+ <data>
10
+  <variable>ProjectExplorer.Project.ActiveTarget</variable>
11
+  <value type="int">0</value>
12
+ </data>
13
+ <data>
14
+  <variable>ProjectExplorer.Project.EditorSettings</variable>
15
+  <valuemap type="QVariantMap">
16
+   <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
17
+   <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
18
+   <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
19
+   <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
20
+    <value type="QString" key="language">Cpp</value>
21
+    <valuemap type="QVariantMap" key="value">
22
+     <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
23
+    </valuemap>
24
+   </valuemap>
25
+   <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
26
+    <value type="QString" key="language">QmlJS</value>
27
+    <valuemap type="QVariantMap" key="value">
28
+     <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
29
+    </valuemap>
30
+   </valuemap>
31
+   <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
32
+   <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
33
+   <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
34
+   <value type="int" key="EditorConfiguration.IndentSize">4</value>
35
+   <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
36
+   <value type="int" key="EditorConfiguration.MarginColumn">80</value>
37
+   <value type="bool" key="EditorConfiguration.MouseHiding">true</value>
38
+   <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
39
+   <value type="int" key="EditorConfiguration.PaddingMode">1</value>
40
+   <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
41
+   <value type="bool" key="EditorConfiguration.ShowMargin">false</value>
42
+   <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
43
+   <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
44
+   <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
45
+   <value type="int" key="EditorConfiguration.TabSize">8</value>
46
+   <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
47
+   <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
48
+   <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
49
+   <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
50
+   <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
51
+   <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
52
+  </valuemap>
53
+ </data>
54
+ <data>
55
+  <variable>ProjectExplorer.Project.PluginSettings</variable>
56
+  <valuemap type="QVariantMap"/>
57
+ </data>
58
+ <data>
59
+  <variable>ProjectExplorer.Project.Target.0</variable>
60
+  <valuemap type="QVariantMap">
61
+   <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.4.1 clang 64bit</value>
62
+   <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.4.1 clang 64bit</value>
63
+   <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.54.clang_64_kit</value>
64
+   <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
65
+   <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
66
+   <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
67
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
68
+    <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/joseortiz/Dropbox/proposals/TUES/public/exercises/build-Steganography-Desktop_Qt_5_4_1_clang_64bit-Debug</value>
69
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
70
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
71
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
72
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
73
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
74
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
75
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
76
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
77
+      <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
78
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
79
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
80
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
81
+     </valuemap>
82
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
83
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
84
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
85
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
86
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
87
+      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
88
+       <value type="QString">-w</value>
89
+       <value type="QString">-r</value>
90
+      </valuelist>
91
+      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
92
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
93
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
94
+     </valuemap>
95
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
96
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
97
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
98
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
99
+    </valuemap>
100
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
101
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
102
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
103
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
104
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
105
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
106
+      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
107
+       <value type="QString">-w</value>
108
+       <value type="QString">-r</value>
109
+      </valuelist>
110
+      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
111
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
112
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
113
+     </valuemap>
114
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
115
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
116
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
117
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
118
+    </valuemap>
119
+    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
120
+    <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
121
+    <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
122
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
123
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
124
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
125
+    <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
126
+    <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
127
+   </valuemap>
128
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
129
+    <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/joseortiz/Dropbox/proposals/TUES/public/exercises/build-Steganography-Desktop_Qt_5_4_1_clang_64bit-Release</value>
130
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
131
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
132
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
133
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
134
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
135
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
136
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
137
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
138
+      <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
139
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
140
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
141
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
142
+     </valuemap>
143
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
144
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
145
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
146
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
147
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
148
+      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
149
+       <value type="QString">-w</value>
150
+       <value type="QString">-r</value>
151
+      </valuelist>
152
+      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
153
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
154
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
155
+     </valuemap>
156
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
157
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
158
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
159
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
160
+    </valuemap>
161
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
162
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
163
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
164
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
165
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
166
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
167
+      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
168
+       <value type="QString">-w</value>
169
+       <value type="QString">-r</value>
170
+      </valuelist>
171
+      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
172
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
173
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
174
+     </valuemap>
175
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
176
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
177
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
178
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
179
+    </valuemap>
180
+    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
181
+    <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
182
+    <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
183
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
184
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
185
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
186
+    <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
187
+    <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
188
+   </valuemap>
189
+   <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
190
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
191
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
192
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
193
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
194
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
195
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
196
+    </valuemap>
197
+    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
198
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
199
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
200
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
201
+   </valuemap>
202
+   <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
203
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
204
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
205
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
206
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
207
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
208
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
209
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
210
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
211
+    <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
212
+    <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
213
+    <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
214
+    <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
215
+    <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
216
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
217
+    <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
218
+    <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
219
+    <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
220
+    <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
221
+    <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
222
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
223
+     <value type="int">0</value>
224
+     <value type="int">1</value>
225
+     <value type="int">2</value>
226
+     <value type="int">3</value>
227
+     <value type="int">4</value>
228
+     <value type="int">5</value>
229
+     <value type="int">6</value>
230
+     <value type="int">7</value>
231
+     <value type="int">8</value>
232
+     <value type="int">9</value>
233
+     <value type="int">10</value>
234
+     <value type="int">11</value>
235
+     <value type="int">12</value>
236
+     <value type="int">13</value>
237
+     <value type="int">14</value>
238
+    </valuelist>
239
+    <value type="int" key="PE.EnvironmentAspect.Base">2</value>
240
+    <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
241
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Steganography</value>
242
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
243
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/Users/joseortiz/Dropbox/proposals/TUES/public/exercises/repetitions-steganography/Steganography.pro</value>
244
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
245
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">Steganography.pro</value>
246
+    <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
247
+    <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
248
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
249
+    <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
250
+    <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
251
+    <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
252
+    <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
253
+    <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
254
+    <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
255
+   </valuemap>
256
+   <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
257
+  </valuemap>
258
+ </data>
259
+ <data>
260
+  <variable>ProjectExplorer.Project.TargetCount</variable>
261
+  <value type="int">1</value>
262
+ </data>
263
+ <data>
264
+  <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
265
+  <value type="int">18</value>
266
+ </data>
267
+ <data>
268
+  <variable>Version</variable>
269
+  <value type="int">18</value>
270
+ </data>
271
+</qtcreator>

+ 5
- 0
images.qrc View File

@@ -0,0 +1,5 @@
1
+<RCC>
2
+    <qresource prefix="/">
3
+        <file>resources/logo.png</file>
4
+    </qresource>
5
+</RCC>

BIN
images/Bitwise.png View File


BIN
images/ejemplo.png View File


BIN
images/figure1.png View File


BIN
images/figure2.png View File


BIN
images/figure3.png View File


BIN
images/gallito.png View File


BIN
images/img1.png View File


BIN
images/img2.png View File


BIN
images/main1.png View File


BIN
images/main2.png View File


BIN
images/main3.png View File


BIN
images/pink.png View File


BIN
images/pug.png View File


BIN
images/puppy.png View File


BIN
images/uprTorre.png View File


BIN
images/vacas.png View File


+ 11
- 0
main.cpp View File

@@ -0,0 +1,11 @@
1
+#include "panel.h"
2
+#include <QApplication>
3
+
4
+int main(int argc, char *argv[])
5
+{
6
+    QApplication a(argc, argv);
7
+    StegaPanel w;
8
+    w.show();
9
+
10
+    return a.exec();
11
+}

+ 159
- 0
mainwindow.cpp View File

@@ -0,0 +1,159 @@
1
+/// \file
2
+
3
+// RAN - 2014/06/10 : Clear the textEdit control image is loaded.
4
+
5
+#include "mainwindow.h"
6
+#include "ui_mainwindow.h"
7
+#include <QtDebug>
8
+#include <QLabel>
9
+#include "steganography.h"
10
+
11
+/// \fn StegaPanel::StegaPanel(QWidget *parent)
12
+/// \~English
13
+/// \brief GUI Constructor
14
+/// \~Spanish
15
+/// \brief Constructor del GUI
16
+StegaPanel::StegaPanel(QWidget *parent) :
17
+    QMainWindow(parent),
18
+    ui(new Ui::StegaPanel)
19
+{
20
+    ui->setupUi(this); //
21
+
22
+}
23
+
24
+/// \fn void StegaPanel::hideMessage()
25
+/// \~English
26
+/// \brief Function that calls the message embedding function.
27
+/// \~Spanish
28
+/// \brief Funcion que llama la funcion de embedir el mensaje.
29
+///
30
+void StegaPanel::hideMessage()
31
+{
32
+
33
+    string binMsg ;         // Will be used to store the message in a binary String format
34
+
35
+    ui->error_msg_label->clear(); //clear error text
36
+    orig_msg = ui->textEdit->toPlainText(); //obtain msg from textEdit
37
+
38
+    if(old_image.isNull()){
39
+        qDebug() << "Load an image first!";
40
+        ui->error_msg_label->setText("NO IMAGE LOADED!");
41
+    }
42
+    else if (orig_msg == NULL){
43
+        ui->error_msg_label->setText("No message to hide!");
44
+    }
45
+    else{
46
+
47
+        binMsg = messageToBinaryString(orig_msg.toStdString()) ;
48
+
49
+        if(((old_image.width() * old_image.height()) * 3) < (int)binMsg.length())
50
+        {
51
+            ui->error_msg_label->setText("IMAGE NOT BIG ENOUGH FOR MESSAGE!");
52
+        }
53
+        else
54
+        {
55
+            EmbbedMessage(old_image, new_image, orig_msg.toStdString()) ;
56
+        }
57
+
58
+        ui->error_msg_label->setText("Message hidden in Stego Image with 1 stego bits.");
59
+    }
60
+}
61
+
62
+
63
+/// \fn void StegaPanel::revealMessage()
64
+/// \~English
65
+/// \brief Function that calls the message extraction function.
66
+/// \~Spanish
67
+/// \brief Funcion que llama la funcion de extraer el mensaje.
68
+///
69
+void StegaPanel::revealMessage()
70
+{
71
+
72
+    string msg = ExtractMessage(new_image) ;
73
+
74
+    if (msg.length() > 0){
75
+        ui->textEdit->setText(QString::fromStdString(msg));
76
+        ui->error_msg_label->setText("Message extracted!");
77
+    }
78
+    else{
79
+        ui->error_msg_label->setText("Could not extract message!");
80
+    }
81
+}
82
+
83
+/// \fn void StegaPanel::on_loadImage_clicked()
84
+/// \~English
85
+/// \brief Event function to load an image from the
86
+///                    file system.
87
+/// \~Spanish
88
+/// \brief Funcion de evento que carga una imagen de el
89
+///                    sistema de archivos.
90
+///
91
+void StegaPanel::on_loadImage_clicked()
92
+{
93
+    QString fname = QFileDialog::getOpenFileName(this, tr("Choose an image"), QDir::homePath());
94
+        if (!fname.isEmpty()){
95
+            QImage image(fname);
96
+            if (image.isNull())
97
+                QMessageBox::information(this, tr("Choose an image"),tr("Cannot load %1.").arg(fname));
98
+            old_image=image;
99
+            new_image=image;
100
+            repaint();
101
+        }
102
+        ui->old_image->setPixmap(QPixmap::fromImage(old_image));
103
+        ui->new_image->setPixmap(QPixmap::fromImage(new_image));
104
+        ui->textEdit->setText("");
105
+        ui->error_msg_label->setText("Image loaded!");
106
+}
107
+
108
+/// \fn void StegaPanel::on_hideMessage_clicked()
109
+/// \~English
110
+/// \brief Event function to hide message into
111
+///                     the image.
112
+/// \~Spanish
113
+/// \brief Funcion de evento para esconder e
114
+///         el mensaje en la imagen.
115
+///
116
+void StegaPanel::on_hideMessage_clicked()
117
+{
118
+    hideMessage();
119
+    ui->new_image->setPixmap(QPixmap::fromImage(new_image));
120
+}
121
+
122
+/// \fn void StegaPanel::on_getMessage_clicked()
123
+/// \~English
124
+/// \brief Event function to extract the message hidden
125
+///                     in the image.
126
+/// \~Spanish
127
+/// \brief Funcion de evento para estraer el mensaje
128
+///                     escondido en la imagen.
129
+///
130
+void StegaPanel::on_getMessage_clicked()
131
+{
132
+    revealMessage();
133
+}
134
+
135
+/// \fn StegaPanel::~StegaPanel()
136
+/// \~English
137
+/// \brief GUI Destructor
138
+/// \~Spanish
139
+/// \brief Destructor del GUI
140
+StegaPanel::~StegaPanel()
141
+{
142
+    delete ui;
143
+}
144
+
145
+/// \fn void StegaPanel::on_storeImage_clicked()
146
+/// \~English
147
+/// \brief on_storeImage_clicked - Event function to save the new image in the
148
+///                             file system.
149
+/// \~Spanish
150
+/// \brief Funcion de evento para salvar la imagen nueva
151
+///                             en el sistema de archivos.
152
+///
153
+void StegaPanel::on_storeImage_clicked()
154
+{
155
+    QPixmap out = QPixmap::grabWidget(this,361,10,481,481);
156
+    QString fname = QFileDialog::getSaveFileName(this, tr("Save Edited Image"), (""), tr("PNG (*.png)" ));
157
+    new_image.save(fname, "PNG");
158
+    ui->error_msg_label->setText("Image saved to" + fname + " !");
159
+}

+ 103
- 0
mainwindow.h View File

@@ -0,0 +1,103 @@
1
+#ifndef STEGAPANEL_H
2
+#define STEGAPANEL_H
3
+
4
+#include <QMainWindow>
5
+#include <QFileDialog>
6
+#include <QDir>
7
+#include <QMessageBox>
8
+#include <QSlider>
9
+#include <QShortcut>
10
+#include <QMessageBox>
11
+#include <string>
12
+
13
+using namespace std ;
14
+
15
+namespace Ui {
16
+class StegaPanel;
17
+}
18
+
19
+class StegaPanel : public QMainWindow
20
+{
21
+    Q_OBJECT
22
+
23
+public:
24
+    /// \fn StegaPanel::StegaPanel(QWidget *parent)
25
+    /// \~English
26
+    /// \brief GUI Constructor
27
+    /// \~Spanish
28
+    /// \brief Constructor del GUI
29
+    explicit StegaPanel(QWidget *parent = 0);
30
+
31
+    /// \fn void StegaPanel::hideMessage()
32
+    /// \~English
33
+    /// \brief Function that calls the message embedding function.
34
+    /// \~Spanish
35
+    /// \brief Funcion que llama la funcion de embedir el mensaje.
36
+    ///
37
+    void hideMessage();
38
+
39
+    /// \fn void StegaPanel::revealMessage()
40
+    /// \~English
41
+    /// \brief Function that calls the message extraction function.
42
+    /// \~Spanish
43
+    /// \brief Funcion que llama la funcion de extraer el mensaje.
44
+    ///
45
+    void revealMessage();
46
+
47
+    /// \fn StegaPanel::~StegaPanel()
48
+    /// \~English
49
+    /// \brief GUI Destructor
50
+    /// \~Spanish
51
+    /// \brief Destructor del GUI
52
+    ~StegaPanel();
53
+
54
+private slots:
55
+    /// \fn void StegaPanel::on_loadImage_clicked()
56
+    /// \~English
57
+    /// \brief Event function to load an image from the
58
+    ///                    file system.
59
+    /// \~Spanish
60
+    /// \brief Funcion de evento que carga una imagen de el
61
+    ///                    sistema de archivos.
62
+    ///
63
+    void on_loadImage_clicked();
64
+
65
+    /// \fn void StegaPanel::on_hideMessage_clicked()
66
+    /// \~English
67
+    /// \brief Event function to hide message into
68
+    ///                     the image.
69
+    /// \~Spanish
70
+    /// \brief Funcion de evento para esconder e
71
+    ///         el mensaje en la imagen.
72
+    ///
73
+    void on_hideMessage_clicked();
74
+
75
+    /// \fn void StegaPanel::on_getMessage_clicked()
76
+    /// \~English
77
+    /// \brief Event function to extract the message hidden
78
+    ///                     in the image.
79
+    /// \~Spanish
80
+    /// \brief Funcion de evento para estraer el mensaje
81
+    ///                     escondido en la imagen.
82
+    ///
83
+    void on_getMessage_clicked();
84
+
85
+    /// \fn void StegaPanel::on_storeImage_clicked()
86
+    /// \~English
87
+    /// \brief on_storeImage_clicked - Event function to save the new image in the
88
+    ///                             file system.
89
+    /// \~Spanish
90
+    /// \brief Funcion de evento para salvar la imagen nueva
91
+    ///                             en el sistema de archivos.
92
+    ///
93
+    void on_storeImage_clicked();
94
+
95
+private:
96
+    Ui::StegaPanel *ui;
97
+    QImage old_image;
98
+    QImage new_image;
99
+    QString orig_msg;
100
+
101
+};
102
+
103
+#endif // MAINWINDOW_H

+ 296
- 0
mainwindow.ui View File

@@ -0,0 +1,296 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<ui version="4.0">
3
+ <class>StegaPanel</class>
4
+ <widget class="QMainWindow" name="StegaPanel">
5
+  <property name="geometry">
6
+   <rect>
7
+    <x>0</x>
8
+    <y>0</y>
9
+    <width>833</width>
10
+    <height>525</height>
11
+   </rect>
12
+  </property>
13
+  <property name="windowTitle">
14
+   <string>Steganography</string>
15
+  </property>
16
+  <property name="styleSheet">
17
+   <string notr="true">background-color:#e5e5e5;</string>
18
+  </property>
19
+  <widget class="QWidget" name="centralWidget">
20
+   <widget class="QLabel" name="old_label">
21
+    <property name="geometry">
22
+     <rect>
23
+      <x>240</x>
24
+      <y>71</y>
25
+      <width>101</width>
26
+      <height>20</height>
27
+     </rect>
28
+    </property>
29
+    <property name="text">
30
+     <string>Original Image</string>
31
+    </property>
32
+   </widget>
33
+   <widget class="QLabel" name="new_label">
34
+    <property name="geometry">
35
+     <rect>
36
+      <x>350</x>
37
+      <y>70</y>
38
+      <width>121</width>
39
+      <height>20</height>
40
+     </rect>
41
+    </property>
42
+    <property name="text">
43
+     <string>Result Image</string>
44
+    </property>
45
+   </widget>
46
+   <widget class="QLabel" name="old_image">
47
+    <property name="geometry">
48
+     <rect>
49
+      <x>20</x>
50
+      <y>90</y>
51
+      <width>321</width>
52
+      <height>381</height>
53
+     </rect>
54
+    </property>
55
+    <property name="baseSize">
56
+     <size>
57
+      <width>0</width>
58
+      <height>0</height>
59
+     </size>
60
+    </property>
61
+    <property name="styleSheet">
62
+     <string notr="true">background-color: #3f3f49</string>
63
+    </property>
64
+    <property name="frameShape">
65
+     <enum>QFrame::StyledPanel</enum>
66
+    </property>
67
+    <property name="text">
68
+     <string/>
69
+    </property>
70
+    <property name="scaledContents">
71
+     <bool>true</bool>
72
+    </property>
73
+   </widget>
74
+   <widget class="QLabel" name="new_image">
75
+    <property name="geometry">
76
+     <rect>
77
+      <x>350</x>
78
+      <y>90</y>
79
+      <width>291</width>
80
+      <height>381</height>
81
+     </rect>
82
+    </property>
83
+    <property name="styleSheet">
84
+     <string notr="true">background-color: #3f3f49</string>
85
+    </property>
86
+    <property name="frameShape">
87
+     <enum>QFrame::StyledPanel</enum>
88
+    </property>
89
+    <property name="text">
90
+     <string/>
91
+    </property>
92
+    <property name="scaledContents">
93
+     <bool>true</bool>
94
+    </property>
95
+   </widget>
96
+   <widget class="QTextEdit" name="textEdit">
97
+    <property name="geometry">
98
+     <rect>
99
+      <x>650</x>
100
+      <y>110</y>
101
+      <width>171</width>
102
+      <height>221</height>
103
+     </rect>
104
+    </property>
105
+    <property name="styleSheet">
106
+     <string notr="true">background-color:white</string>
107
+    </property>
108
+    <property name="html">
109
+     <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
110
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
111
+p, li { white-space: pre-wrap; }
112
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
113
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Lucida Grande'; font-size:13pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
114
+    </property>
115
+   </widget>
116
+   <widget class="QLabel" name="error_msg_label">
117
+    <property name="geometry">
118
+     <rect>
119
+      <x>250</x>
120
+      <y>571</y>
121
+      <width>581</width>
122
+      <height>20</height>
123
+     </rect>
124
+    </property>
125
+    <property name="text">
126
+     <string/>
127
+    </property>
128
+   </widget>
129
+   <widget class="QFrame" name="frame">
130
+    <property name="geometry">
131
+     <rect>
132
+      <x>-20</x>
133
+      <y>-20</y>
134
+      <width>861</width>
135
+      <height>91</height>
136
+     </rect>
137
+    </property>
138
+    <property name="styleSheet">
139
+     <string notr="true">background-color:#c2050b
140
+;
141
+border-color:#525662;</string>
142
+    </property>
143
+    <property name="frameShape">
144
+     <enum>QFrame::StyledPanel</enum>
145
+    </property>
146
+    <property name="frameShadow">
147
+     <enum>QFrame::Raised</enum>
148
+    </property>
149
+    <widget class="QLabel" name="old_label_2">
150
+     <property name="geometry">
151
+      <rect>
152
+       <x>300</x>
153
+       <y>20</y>
154
+       <width>241</width>
155
+       <height>61</height>
156
+      </rect>
157
+     </property>
158
+     <property name="font">
159
+      <font>
160
+       <pointsize>25</pointsize>
161
+      </font>
162
+     </property>
163
+     <property name="styleSheet">
164
+      <string notr="true">color:#f9ffff;</string>
165
+     </property>
166
+     <property name="text">
167
+      <string>Steganography</string>
168
+     </property>
169
+    </widget>
170
+   </widget>
171
+   <widget class="QPushButton" name="loadImage">
172
+    <property name="geometry">
173
+     <rect>
174
+      <x>170</x>
175
+      <y>480</y>
176
+      <width>169</width>
177
+      <height>41</height>
178
+     </rect>
179
+    </property>
180
+    <property name="styleSheet">
181
+     <string notr="true">background-color: gray;
182
+border-style: outset;
183
+border-width: 2px;
184
+border-color:gray;
185
+color:white;
186
+
187
+</string>
188
+    </property>
189
+    <property name="text">
190
+     <string>Load Image</string>
191
+    </property>
192
+   </widget>
193
+   <widget class="QPushButton" name="storeImage">
194
+    <property name="geometry">
195
+     <rect>
196
+      <x>350</x>
197
+      <y>480</y>
198
+      <width>169</width>
199
+      <height>41</height>
200
+     </rect>
201
+    </property>
202
+    <property name="styleSheet">
203
+     <string notr="true">background-color: gray;
204
+border-style: outset;
205
+border-width: 2px;
206
+border-color:gray;
207
+color:white;
208
+
209
+</string>
210
+    </property>
211
+    <property name="text">
212
+     <string>Store New Image</string>
213
+    </property>
214
+   </widget>
215
+   <widget class="QLabel" name="new_label_2">
216
+    <property name="geometry">
217
+     <rect>
218
+      <x>650</x>
219
+      <y>90</y>
220
+      <width>121</width>
221
+      <height>20</height>
222
+     </rect>
223
+    </property>
224
+    <property name="text">
225
+     <string>Write a message:</string>
226
+    </property>
227
+   </widget>
228
+   <widget class="QPushButton" name="getMessage">
229
+    <property name="geometry">
230
+     <rect>
231
+      <x>650</x>
232
+      <y>370</y>
233
+      <width>169</width>
234
+      <height>41</height>
235
+     </rect>
236
+    </property>
237
+    <property name="styleSheet">
238
+     <string notr="true">background-color: gray;
239
+border-style: outset;
240
+border-width: 2px;
241
+border-color:gray;
242
+color:white;
243
+
244
+</string>
245
+    </property>
246
+    <property name="text">
247
+     <string>Retrieve Message</string>
248
+    </property>
249
+   </widget>
250
+   <widget class="QPushButton" name="hideMessage">
251
+    <property name="geometry">
252
+     <rect>
253
+      <x>650</x>
254
+      <y>420</y>
255
+      <width>169</width>
256
+      <height>41</height>
257
+     </rect>
258
+    </property>
259
+    <property name="styleSheet">
260
+     <string notr="true">background-color: gray;
261
+border-style: outset;
262
+border-width: 2px;
263
+border-color:gray;
264
+color:white;
265
+
266
+</string>
267
+    </property>
268
+    <property name="text">
269
+     <string>Hide Message</string>
270
+    </property>
271
+   </widget>
272
+   <widget class="QFrame" name="frame_2">
273
+    <property name="geometry">
274
+     <rect>
275
+      <x>630</x>
276
+      <y>470</y>
277
+      <width>221</width>
278
+      <height>121</height>
279
+     </rect>
280
+    </property>
281
+    <property name="styleSheet">
282
+     <string notr="true">background-image: url(:/resources/logo.png);</string>
283
+    </property>
284
+    <property name="frameShape">
285
+     <enum>QFrame::NoFrame</enum>
286
+    </property>
287
+    <property name="frameShadow">
288
+     <enum>QFrame::Raised</enum>
289
+    </property>
290
+   </widget>
291
+  </widget>
292
+ </widget>
293
+ <layoutdefault spacing="6" margin="11"/>
294
+ <resources/>
295
+ <connections/>
296
+</ui>

+ 123
- 0
moc_StegaPanel.cpp View File

@@ -0,0 +1,123 @@
1
+/****************************************************************************
2
+** Meta object code from reading C++ file 'StegaPanel.h'
3
+**
4
+** Created by: The Qt Meta Object Compiler version 67 (Qt 5.2.1)
5
+**
6
+** WARNING! All changes made in this file will be lost!
7
+*****************************************************************************/
8
+
9
+#include "StegaPanel.h"
10
+#include <QtCore/qbytearray.h>
11
+#include <QtCore/qmetatype.h>
12
+#if !defined(Q_MOC_OUTPUT_REVISION)
13
+#error "The header file 'StegaPanel.h' doesn't include <QObject>."
14
+#elif Q_MOC_OUTPUT_REVISION != 67
15
+#error "This file was generated using the moc from 5.2.1. It"
16
+#error "cannot be used with the include files from this version of Qt."
17
+#error "(The moc has changed too much.)"
18
+#endif
19
+
20
+QT_BEGIN_MOC_NAMESPACE
21
+struct qt_meta_stringdata_StegaPanel_t {
22
+    QByteArrayData data[6];
23
+    char stringdata[101];
24
+};
25
+#define QT_MOC_LITERAL(idx, ofs, len) \
26
+    Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
27
+    offsetof(qt_meta_stringdata_StegaPanel_t, stringdata) + ofs \
28
+        - idx * sizeof(QByteArrayData) \
29
+    )
30
+static const qt_meta_stringdata_StegaPanel_t qt_meta_stringdata_StegaPanel = {
31
+    {
32
+QT_MOC_LITERAL(0, 0, 10),
33
+QT_MOC_LITERAL(1, 11, 20),
34
+QT_MOC_LITERAL(2, 32, 0),
35
+QT_MOC_LITERAL(3, 33, 22),
36
+QT_MOC_LITERAL(4, 56, 21),
37
+QT_MOC_LITERAL(5, 78, 21)
38
+    },
39
+    "StegaPanel\0on_loadImage_clicked\0\0"
40
+    "on_hideMessage_clicked\0on_getMessage_clicked\0"
41
+    "on_storeImage_clicked\0"
42
+};
43
+#undef QT_MOC_LITERAL
44
+
45
+static const uint qt_meta_data_StegaPanel[] = {
46
+
47
+ // content:
48
+       7,       // revision
49
+       0,       // classname
50
+       0,    0, // classinfo
51
+       4,   14, // methods
52
+       0,    0, // properties
53
+       0,    0, // enums/sets
54
+       0,    0, // constructors
55
+       0,       // flags
56
+       0,       // signalCount
57
+
58
+ // slots: name, argc, parameters, tag, flags
59
+       1,    0,   34,    2, 0x08,
60
+       3,    0,   35,    2, 0x08,
61
+       4,    0,   36,    2, 0x08,
62
+       5,    0,   37,    2, 0x08,
63
+
64
+ // slots: parameters
65
+    QMetaType::Void,
66
+    QMetaType::Void,
67
+    QMetaType::Void,
68
+    QMetaType::Void,
69
+
70
+       0        // eod
71
+};
72
+
73
+void StegaPanel::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
74
+{
75
+    if (_c == QMetaObject::InvokeMetaMethod) {
76
+        StegaPanel *_t = static_cast<StegaPanel *>(_o);
77
+        switch (_id) {
78
+        case 0: _t->on_loadImage_clicked(); break;
79
+        case 1: _t->on_hideMessage_clicked(); break;
80
+        case 2: _t->on_getMessage_clicked(); break;
81
+        case 3: _t->on_storeImage_clicked(); break;
82
+        default: ;
83
+        }
84
+    }
85
+    Q_UNUSED(_a);
86
+}
87
+
88
+const QMetaObject StegaPanel::staticMetaObject = {
89
+    { &QMainWindow::staticMetaObject, qt_meta_stringdata_StegaPanel.data,
90
+      qt_meta_data_StegaPanel,  qt_static_metacall, 0, 0}
91
+};
92
+
93
+
94
+const QMetaObject *StegaPanel::metaObject() const
95
+{
96
+    return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
97
+}
98
+
99
+void *StegaPanel::qt_metacast(const char *_clname)
100
+{
101
+    if (!_clname) return 0;
102
+    if (!strcmp(_clname, qt_meta_stringdata_StegaPanel.stringdata))
103
+        return static_cast<void*>(const_cast< StegaPanel*>(this));
104
+    return QMainWindow::qt_metacast(_clname);
105
+}
106
+
107
+int StegaPanel::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
108
+{
109
+    _id = QMainWindow::qt_metacall(_c, _id, _a);
110
+    if (_id < 0)
111
+        return _id;
112
+    if (_c == QMetaObject::InvokeMetaMethod) {
113
+        if (_id < 4)
114
+            qt_static_metacall(this, _c, _id, _a);
115
+        _id -= 4;
116
+    } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
117
+        if (_id < 4)
118
+            *reinterpret_cast<int*>(_a[0]) = -1;
119
+        _id -= 4;
120
+    }
121
+    return _id;
122
+}
123
+QT_END_MOC_NAMESPACE

+ 106
- 0
panel.cpp View File

@@ -0,0 +1,106 @@
1
+// RAN - 2014/06/10 : Clear the textEdit control image is loaded.
2
+
3
+#include "panel.h"
4
+#include "ui_panel.h"
5
+#include <QtDebug>
6
+#include <QLabel>
7
+#include "steganography.h"
8
+
9
+StegaPanel::StegaPanel(QWidget *parent) :
10
+    QMainWindow(parent),
11
+    ui(new Ui::StegaPanel)
12
+{
13
+    leastBits = 1; //initialize to 1 bits used in pixel for message
14
+    ui->setupUi(this); //
15
+
16
+}
17
+
18
+
19
+void StegaPanel::hideMessage()
20
+{
21
+
22
+    string binMsg ;         // Will be used to store the message in a binary String format
23
+
24
+    ui->error_msg_label->clear(); //clear error text
25
+    orig_msg = ui->textEdit->toPlainText(); //obtain msg from textEdit
26
+    leastBits = ui->bitBox->value(); //get number of least significant bits to use for msg
27
+
28
+    if(old_image.isNull()){
29
+        qDebug() << "Load an image first!";
30
+        ui->error_msg_label->setText("NO IMAGE LOADED!");
31
+    }
32
+    else if (orig_msg == NULL){
33
+        ui->error_msg_label->setText("No message to hide!");
34
+    }
35
+    else{
36
+
37
+        binMsg = messageToBinaryString(orig_msg.toStdString(), leastBits) ;
38
+
39
+        if(((old_image.width() * old_image.height()) * 3 * leastBits) < binMsg.length())
40
+        {
41
+            ui->error_msg_label->setText("IMAGE NOT BIG ENOUGH FOR MESSAGE!");
42
+        }
43
+        else
44
+        {
45
+            EmbbedMessage(old_image, new_image, orig_msg.toStdString(), leastBits) ;
46
+        }
47
+
48
+        ui->error_msg_label->setText("Message hidden in Stego Image with " + QString::number(leastBits) + " stego bits.");
49
+    }
50
+}
51
+
52
+void StegaPanel::revealMessage()
53
+{
54
+
55
+    string msg = ExtractMessage(new_image, ui->bitBox->value()) ;
56
+
57
+    if (msg.length() > 0){
58
+        ui->textEdit->setText(QString::fromStdString(msg));
59
+        ui->error_msg_label->setText("Message extracted!");
60
+    }
61
+    else{
62
+        ui->error_msg_label->setText("Could not extract message!");
63
+    }
64
+}
65
+
66
+void StegaPanel::on_loadImage_clicked()
67
+{
68
+    QString fname = QFileDialog::getOpenFileName(this, tr("Choose an image"), QDir::homePath());
69
+        if (!fname.isEmpty()){
70
+            QImage image(fname);
71
+            if (image.isNull())
72
+                QMessageBox::information(this, tr("Choose an image"),tr("Cannot load %1.").arg(fname));
73
+            old_image=image;
74
+            new_image=image;
75
+            repaint();
76
+        }
77
+        ui->old_image->setPixmap(QPixmap::fromImage(old_image));
78
+        ui->new_image->setPixmap(QPixmap::fromImage(new_image));
79
+        ui->textEdit->setText("");
80
+        ui->error_msg_label->setText("Image loaded!");
81
+}
82
+
83
+void StegaPanel::on_hideMessage_clicked()
84
+{
85
+    hideMessage();
86
+    ui->new_image->setPixmap(QPixmap::fromImage(new_image));
87
+}
88
+
89
+void StegaPanel::on_getMessage_clicked()
90
+{
91
+    revealMessage();
92
+}
93
+
94
+
95
+StegaPanel::~StegaPanel()
96
+{
97
+    delete ui;
98
+}
99
+
100
+void StegaPanel::on_storeImage_clicked()
101
+{
102
+    QPixmap out = QPixmap::grabWidget(this,361,10,481,481);
103
+    QString fname = QFileDialog::getSaveFileName(this, tr("Save Edited Image"), (""), tr("PNG (*.png)" ));
104
+    new_image.save(fname, "PNG");
105
+    ui->error_msg_label->setText("Image saved to" + fname + " !");
106
+}

+ 45
- 0
panel.h View File

@@ -0,0 +1,45 @@
1
+#ifndef STEGAPANEL_H
2
+#define STEGAPANEL_H
3
+
4
+#include <QMainWindow>
5
+#include <QFileDialog>
6
+#include <QDir>
7
+#include <QMessageBox>
8
+#include <QSlider>
9
+#include <QShortcut>
10
+#include <QMessageBox>
11
+#include <string>
12
+
13
+using namespace std ;
14
+
15
+namespace Ui {
16
+class StegaPanel;
17
+}
18
+
19
+class StegaPanel : public QMainWindow
20
+{
21
+    Q_OBJECT
22
+
23
+public:
24
+    explicit StegaPanel(QWidget *parent = 0);
25
+    void hideMessage();
26
+    void revealMessage();
27
+    ~StegaPanel();
28
+
29
+private slots:
30
+    void on_loadImage_clicked();
31
+    void on_hideMessage_clicked();
32
+    void on_getMessage_clicked();
33
+
34
+    void on_storeImage_clicked();
35
+
36
+private:
37
+    Ui::StegaPanel *ui;
38
+    QImage old_image;
39
+    QImage new_image;
40
+    int leastBits; //number of bits used in pixel for message
41
+    QString orig_msg;
42
+
43
+};
44
+
45
+#endif // MAINWINDOW_H

+ 336
- 0
panel.ui View File

@@ -0,0 +1,336 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<ui version="4.0">
3
+ <class>StegaPanel</class>
4
+ <widget class="QMainWindow" name="StegaPanel">
5
+  <property name="geometry">
6
+   <rect>
7
+    <x>0</x>
8
+    <y>0</y>
9
+    <width>833</width>
10
+    <height>525</height>
11
+   </rect>
12
+  </property>
13
+  <property name="windowTitle">
14
+   <string>Steganography</string>
15
+  </property>
16
+  <property name="styleSheet">
17
+   <string notr="true">background-color:#e5e5e5;</string>
18
+  </property>
19
+  <widget class="QWidget" name="centralWidget">
20
+   <widget class="QLabel" name="old_label">
21
+    <property name="geometry">
22
+     <rect>
23
+      <x>240</x>
24
+      <y>71</y>
25
+      <width>101</width>
26
+      <height>20</height>
27
+     </rect>
28
+    </property>
29
+    <property name="text">
30
+     <string>Original Image</string>
31
+    </property>
32
+   </widget>
33
+   <widget class="QLabel" name="new_label">
34
+    <property name="geometry">
35
+     <rect>
36
+      <x>350</x>
37
+      <y>70</y>
38
+      <width>121</width>
39
+      <height>20</height>
40
+     </rect>
41
+    </property>
42
+    <property name="text">
43
+     <string>Result Image</string>
44
+    </property>
45
+   </widget>
46
+   <widget class="QLabel" name="old_image">
47
+    <property name="geometry">
48
+     <rect>
49
+      <x>20</x>
50
+      <y>90</y>
51
+      <width>321</width>
52
+      <height>381</height>
53
+     </rect>
54
+    </property>
55
+    <property name="baseSize">
56
+     <size>
57
+      <width>0</width>
58
+      <height>0</height>
59
+     </size>
60
+    </property>
61
+    <property name="styleSheet">
62
+     <string notr="true">background-color: #3f3f49</string>
63
+    </property>
64
+    <property name="frameShape">
65
+     <enum>QFrame::StyledPanel</enum>
66
+    </property>
67
+    <property name="text">
68
+     <string/>
69
+    </property>
70
+    <property name="scaledContents">
71
+     <bool>true</bool>
72
+    </property>
73
+   </widget>
74
+   <widget class="QLabel" name="new_image">
75
+    <property name="geometry">
76
+     <rect>
77
+      <x>350</x>
78
+      <y>90</y>
79
+      <width>291</width>
80
+      <height>381</height>
81
+     </rect>
82
+    </property>
83
+    <property name="styleSheet">
84
+     <string notr="true">background-color: #3f3f49</string>
85
+    </property>
86
+    <property name="frameShape">
87
+     <enum>QFrame::StyledPanel</enum>
88
+    </property>
89
+    <property name="text">
90
+     <string/>
91
+    </property>
92
+    <property name="scaledContents">
93
+     <bool>true</bool>
94
+    </property>
95
+   </widget>
96
+   <widget class="QTextEdit" name="textEdit">
97
+    <property name="geometry">
98
+     <rect>
99
+      <x>650</x>
100
+      <y>110</y>
101
+      <width>171</width>
102
+      <height>121</height>
103
+     </rect>
104
+    </property>
105
+    <property name="styleSheet">
106
+     <string notr="true">background-color:white</string>
107
+    </property>
108
+    <property name="html">
109
+     <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
110
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
111
+p, li { white-space: pre-wrap; }
112
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
113
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Lucida Grande'; font-size:13pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
114
+    </property>
115
+   </widget>
116
+   <widget class="QLabel" name="error_msg_label">
117
+    <property name="geometry">
118
+     <rect>
119
+      <x>250</x>
120
+      <y>571</y>
121
+      <width>581</width>
122
+      <height>20</height>
123
+     </rect>
124
+    </property>
125
+    <property name="text">
126
+     <string/>
127
+    </property>
128
+   </widget>
129
+   <widget class="QFrame" name="frame">
130
+    <property name="geometry">
131
+     <rect>
132
+      <x>-20</x>
133
+      <y>-20</y>
134
+      <width>861</width>
135
+      <height>91</height>
136
+     </rect>
137
+    </property>
138
+    <property name="styleSheet">
139
+     <string notr="true">background-color:#c2050b
140
+;
141
+border-color:#525662;</string>
142
+    </property>
143
+    <property name="frameShape">
144
+     <enum>QFrame::StyledPanel</enum>
145
+    </property>
146
+    <property name="frameShadow">
147
+     <enum>QFrame::Raised</enum>
148
+    </property>
149
+    <widget class="QLabel" name="old_label_2">
150
+     <property name="geometry">
151
+      <rect>
152
+       <x>300</x>
153
+       <y>20</y>
154
+       <width>241</width>
155
+       <height>61</height>
156
+      </rect>
157
+     </property>
158
+     <property name="font">
159
+      <font>
160
+       <pointsize>25</pointsize>
161
+      </font>
162
+     </property>
163
+     <property name="styleSheet">
164
+      <string notr="true">color:#f9ffff;</string>
165
+     </property>
166
+     <property name="text">
167
+      <string>Steganography</string>
168
+     </property>
169
+    </widget>
170
+   </widget>
171
+   <widget class="QPushButton" name="loadImage">
172
+    <property name="geometry">
173
+     <rect>
174
+      <x>170</x>
175
+      <y>480</y>
176
+      <width>169</width>
177
+      <height>41</height>
178
+     </rect>
179
+    </property>
180
+    <property name="styleSheet">
181
+     <string notr="true">background-color: gray;
182
+border-style: outset;
183
+border-width: 2px; 
184
+border-color:gray;
185
+color:white;
186
+
187
+</string>
188
+    </property>
189
+    <property name="text">
190
+     <string>Load Image</string>
191
+    </property>
192
+   </widget>
193
+   <widget class="QPushButton" name="storeImage">
194
+    <property name="geometry">
195
+     <rect>
196
+      <x>350</x>
197
+      <y>480</y>
198
+      <width>169</width>
199
+      <height>41</height>
200
+     </rect>
201
+    </property>
202
+    <property name="styleSheet">
203
+     <string notr="true">background-color: gray;
204
+border-style: outset;
205
+border-width: 2px; 
206
+border-color:gray;
207
+color:white;
208
+
209
+</string>
210
+    </property>
211
+    <property name="text">
212
+     <string>Store New Image</string>
213
+    </property>
214
+   </widget>
215
+   <widget class="QLabel" name="new_label_2">
216
+    <property name="geometry">
217
+     <rect>
218
+      <x>650</x>
219
+      <y>90</y>
220
+      <width>121</width>
221
+      <height>20</height>
222
+     </rect>
223
+    </property>
224
+    <property name="text">
225
+     <string>Write a message:</string>
226
+    </property>
227
+   </widget>
228
+   <widget class="QPushButton" name="getMessage">
229
+    <property name="geometry">
230
+     <rect>
231
+      <x>650</x>
232
+      <y>370</y>
233
+      <width>169</width>
234
+      <height>41</height>
235
+     </rect>
236
+    </property>
237
+    <property name="styleSheet">
238
+     <string notr="true">background-color: gray;
239
+border-style: outset;
240
+border-width: 2px; 
241
+border-color:gray;
242
+color:white;
243
+
244
+</string>
245
+    </property>
246
+    <property name="text">
247
+     <string>Retrieve Message</string>
248
+    </property>
249
+   </widget>
250
+   <widget class="QPushButton" name="hideMessage">
251
+    <property name="geometry">
252
+     <rect>
253
+      <x>650</x>
254
+      <y>420</y>
255
+      <width>169</width>
256
+      <height>41</height>
257
+     </rect>
258
+    </property>
259
+    <property name="styleSheet">
260
+     <string notr="true">background-color: gray;
261
+border-style: outset;
262
+border-width: 2px; 
263
+border-color:gray;
264
+color:white;
265
+
266
+</string>
267
+    </property>
268
+    <property name="text">
269
+     <string>Hide Message</string>
270
+    </property>
271
+   </widget>
272
+   <widget class="QSpinBox" name="bitBox">
273
+    <property name="geometry">
274
+     <rect>
275
+      <x>650</x>
276
+      <y>280</y>
277
+      <width>171</width>
278
+      <height>41</height>
279
+     </rect>
280
+    </property>
281
+    <property name="styleSheet">
282
+     <string notr="true">background-color: gray;
283
+border-style: outset;
284
+border-width: 2px; 
285
+border-color:gray;
286
+color:white;
287
+
288
+</string>
289
+    </property>
290
+    <property name="minimum">
291
+     <number>1</number>
292
+    </property>
293
+    <property name="maximum">
294
+     <number>8</number>
295
+    </property>
296
+   </widget>
297
+   <widget class="QFrame" name="frame_2">
298
+    <property name="geometry">
299
+     <rect>
300
+      <x>630</x>
301
+      <y>470</y>
302
+      <width>221</width>
303
+      <height>51</height>
304
+     </rect>
305
+    </property>
306
+    <property name="styleSheet">
307
+     <string notr="true">background-image: url(/home/rgb/Desktop/eip/CaesarCipher/logo.png);
308
+border: 0px;
309
+repeat: no-repeat;</string>
310
+    </property>
311
+    <property name="frameShape">
312
+     <enum>QFrame::StyledPanel</enum>
313
+    </property>
314
+    <property name="frameShadow">
315
+     <enum>QFrame::Raised</enum>
316
+    </property>
317
+   </widget>
318
+   <widget class="QLabel" name="new_label_3">
319
+    <property name="geometry">
320
+     <rect>
321
+      <x>650</x>
322
+      <y>250</y>
323
+      <width>121</width>
324
+      <height>20</height>
325
+     </rect>
326
+    </property>
327
+    <property name="text">
328
+     <string>Number of Bits</string>
329
+    </property>
330
+   </widget>
331
+  </widget>
332
+ </widget>
333
+ <layoutdefault spacing="6" margin="11"/>
334
+ <resources/>
335
+ <connections/>
336
+</ui>

BIN
resources/logo.png View File


+ 22
- 0
stega.pro View File

@@ -0,0 +1,22 @@
1
+#-------------------------------------------------
2
+#
3
+# Project created by QtCreator 2014-10-03T09:43:48
4
+#
5
+#-------------------------------------------------
6
+
7
+QT       += core gui
8
+
9
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
10
+
11
+TARGET = stega
12
+TEMPLATE = app
13
+
14
+
15
+SOURCES += main.cpp\
16
+        mainwindow.cpp \
17
+    steganography.cpp
18
+
19
+HEADERS  += mainwindow.h \
20
+    steganography.h
21
+
22
+FORMS    += mainwindow.ui

+ 292
- 0
steganography.cpp View File

@@ -0,0 +1,292 @@
1
+/// \file
2
+// RAN 2014-06-10:
3
+//  -- Simplified the changeMask function.
4
+//  -- Simplified the masking in the EmbbedMessage function.
5
+//  -- Changed EmbbedMessage so that only the pixels needed to embbed the message
6
+//     are changed. Previously, all pixels were masked. This involved hardcoding a
7
+//     postfix into the encodded message that repeats ASCII code 0 ten times.
8
+
9
+// RAN 2014-06-14:
10
+//  -- Simplified the end of message encoding and decoding. Now it just encodes one '\0'
11
+//     char at the end of the string. Also, its stops decoding when it finds a '\0'
12
+
13
+// RAN 2015-06-30
14
+//  -- In the functions binaryStringToMessage and ExtractMessage, changed
15
+//     string additions to character push_back.
16
+
17
+
18
+#include "steganography.h"
19
+#include <QDebug>
20
+Steganography::Steganography()
21
+{
22
+}
23
+
24
+/// \fn int cbtoi(char c)
25
+/// \~English
26
+/// \brief Converts a character bit to integer.
27
+/// \param c a character ('0' or '1'), the char that will be converted
28
+/// \return An integer 1 or 0
29
+/// \~Spanish
30
+/// \brief Convierte un bit en caracter a entero.
31
+/// \param c un caracter ('0' o '1'), el caracter que se va a convertir.
32
+/// \return Un entero 1 o 0
33
+///
34
+int cbtoi(char c){
35
+    if(c == '0') return 0;
36
+    else return 1 ;
37
+}
38
+
39
+/// \fn string decToBin(int num, int pad)
40
+/// \~English
41
+/// \brief Converts an decimal number to a string in base 2.
42
+/// \param num a non-negative integer, the number that will be converted
43
+/// \param pad a non-negative integer, the number of digits
44
+///             in the resulting string
45
+/// \return A string of length pad of 0's and/or 1's.
46
+/// \~Spanish
47
+/// \brief Convierte un numero entero a una cadena de caracteres
48
+///                 en base 2.
49
+/// \param num un entero positivo, el numero que se va a convertir.
50
+/// \param pad un entero positivo, el numero de digitos en la cadena de
51
+///             caracteres resultante.
52
+/// \return Una cadena de caracteres de largo pad de 0's y/o 1's
53
+///
54
+string decToBin(int num, int pad)
55
+{
56
+    int r =  0;    // residue
57
+                   // residuo
58
+    int q = -1;    // quotient
59
+                   // cociente
60
+    string b = ""; // string to containt the result
61
+                   // cadena de caracteres para contener el resultado
62
+
63
+
64
+    while(q != 0)
65
+    {
66
+        r = num%2;
67
+        q = num/2;
68
+        num = q;
69
+
70
+        if (r) b.insert(0, "1");
71
+        else   b.insert(0, "0");
72
+    }
73
+
74
+    // if letter has less than pad bits, insert 0s at the beginning until length = pad
75
+    // si letter tiene menos que pad bits, insertar 0s al principio hasta que el
76
+    // length = pad
77
+    while(b.length() < (unsigned long) pad)
78
+        b.insert(0, "0");
79
+
80
+    return b;
81
+}
82
+
83
+
84
+/// \fn string messageToBinaryString(string str)
85
+/// \~English
86
+/// \brief Converts a string to a string of 1's and 0's
87
+/// that represent the ASCII codes of the characters in the original string.
88
+/// For example, "AB" results in "10000011000010".
89
+///                               [-----][-----]
90
+///                                  ^      ^
91
+///                 ASCII code of A  |      |
92
+///                 ASCII code of B --------+
93
+///
94
+/// \param str a string of characters to be converted to their ASCII representations
95
+/// \return A string of 0's and/or 1's.
96
+/// \~Spanish
97
+/// \brief Convierte una caena de caracteres a una cadena de 1's y 0's
98
+/// que representa el codigo ASCII de los caracteren en la cadena original.
99
+/// Por ejemplo, "AB" resulta in "10000011000010".
100
+///                               [-----][-----]
101
+///                                  ^      ^
102
+///              Codigo ASCII  de A  |      |
103
+///              Codigo ASCII  de B --------+
104
+/// \param str una cadena de caracteres a ser convertido a su representacion ASCII
105
+/// \return Una cadena de 0's y/o 1's.
106
+///
107
+string messageToBinaryString(string str){
108
+    string binStr = "";
109
+    int temp;
110
+
111
+    //converting message to binary string
112
+    //convirtiendo un mensaje a una cadena de caracteres binarios
113
+    for(unsigned int i = 0; i<str.length(); i++)
114
+    {
115
+        temp = static_cast<int>(str[i]);
116
+        binStr.append(decToBin(temp, bitsPerLetter));
117
+    }
118
+
119
+    return binStr ;
120
+}
121
+
122
+/// \fn char binStringToChar(string str)
123
+/// \~English
124
+/// \brief binStringToChar: Converts a string of 0's and 1's to an caracter
125
+/// Example, with str="0011", returns the caracter 3.///
126
+/// \param str: a string of 0's and 1's
127
+/// \return A character whose binary representation is equivalent
128
+///    to the string.
129
+/// \~Spanish
130
+/// \brief Convierte una cadena de 0's y 1's a un caracter.
131
+/// Ejemplo, con str="00000011", devuelve el caracter 3.
132
+/// \param str una cadena de 0's y 1's
133
+/// \return Un caracter ASCII cuya representacion binaria es equivalente a la cadena str.
134
+///
135
+char binStringToChar(string str){
136
+
137
+    int value = 0 ;
138
+    for(unsigned int i = 0; i < str.length(); i++){
139
+        value = value << 1 ;
140
+        if(str[i] == '1') value = value | 1 ;
141
+    }
142
+    return static_cast<char>(value) ;
143
+}
144
+
145
+/// \fn int createMask(int lbits)
146
+/// \~English
147
+/// \brief Creates a mask of lbit 1's in the least significant positions.
148
+/// Example, with lbits=4, returns the integer 15, which is mask 0x1111.
149
+/// \param lbits a non-negative integer, the number of bits to set to one
150
+/// \return An integer with lbit 1's in the least signicant positions.
151
+/// \~Spanish
152
+/// \brief Crea una mascara de lbit 1's en las posiciones menos significativas.
153
+/// Ejemplo, con lbits=4, devuelve el entero 15, cuya mascara es 0x1111.
154
+/// \param lbits un entero no negativo, el numero de bits a poner en uno.
155
+/// \return Un entero con lbit 1's en las posiciones menos significativas.
156
+///
157
+int createMask(int lbits){
158
+    return (1 << lbits) - 1;
159
+}
160
+
161
+
162
+/// \fn EmbbedMessage(const QImage & origImage, QImage & newImage, string msg)
163
+/// \~English
164
+/// \brief Given an image (origImage) will create a new image (&newImage) by
165
+/// embedding the bits of the msg into the least significant bits of
166
+/// pixel colors of the original image.
167
+/// \param origImage the original image will not be modified
168
+/// \param newImage the image that is created
169
+/// \param msg the string that will be embedded
170
+/// \return By reference, the newImage is returned, containing the embedded message
171
+/// \~Spanish
172
+/// \brief Dada una imagen (origImage) creara una imagen nueva(&newImage)
173
+/// empotrando los bits de el mensaje msg en los bits menos significativos de los
174
+/// colores de la imagen original.
175
+/// \param origImage la imagen original no va a ser modificada
176
+/// \param newImage la imagen que se crea
177
+/// \param msg la cadena que va a ser empotrada
178
+/// \return Por referencia, es devuelta newImage, conteniendo el mensaje empotrado.
179
+///
180
+void EmbbedMessage(const QImage & origImage, QImage & newImage, string msg){
181
+    string binMsg ; // To store the message in binary.
182
+                    // Para almacenar el mensaje en binario.
183
+    unsigned long msg_index = 0 ;     // Will be used to pass through binStr
184
+                                      // Sera utilizado para pasar atraves de binStr
185
+    int red, green, blue ;            // Will store the integer representation of the colors.
186
+                                      // Va a guardar la representacion entera de los colores
187
+
188
+    int mask = createMask(1);
189
+    QRgb p;
190
+
191
+    binMsg = messageToBinaryString(msg);
192
+
193
+    // We will include this postfix, so that the decoder will
194
+    // know when the embedded message ends. It consists of 1 char
195
+    // whose ASCII is 0.
196
+    // Vamos a incluir este sufijo, tal que el decodificador sepa
197
+    // cuando el mensaje embedido termina.  Este consiste de 1 caracter
198
+    // cuyo ASCII es 0.
199
+    binMsg.append(2*bitsPerLetter,'0');
200
+
201
+    //for each pixel in image
202
+    //por cada pixel.
203
+    for(int i = 0; i < origImage.width(); i++)
204
+    {
205
+        for(int j = 0; j<origImage.height(); j++)
206
+        {
207
+            p = origImage.pixel(i,j);
208
+
209
+            red  = qRed(p);
210
+
211
+            if(msg_index < binMsg.length()){
212
+                // clear the least significant bit of the red value
213
+                // limpia el bit menos significativo del valor rojo
214
+                red &= ~mask;
215
+                // embed the corresponding bits from the mssage
216
+                // empotra el bit correspondiente del mensaje
217
+                red = red | cbtoi(binMsg[msg_index]) ;
218
+                msg_index += 1 ;
219
+            }
220
+
221
+            green = qGreen(p);
222
+
223
+            if(msg_index < binMsg.length()){
224
+                green &= ~mask;
225
+                green = green | cbtoi(binMsg[msg_index]);
226
+                msg_index += 1 ;
227
+            }
228
+
229
+            blue  = qBlue(p);
230
+
231
+            if(msg_index < binMsg.length()){
232
+                blue &= ~mask;
233
+                blue = blue |  cbtoi(binMsg[msg_index]);
234
+                msg_index += 1 ;
235
+            }
236
+            else{
237
+                // When the message is over we stop the loops
238
+                // Cuando el mensaje termina paramos los loops
239
+                i = origImage.width() ;
240
+                break ;
241
+            }
242
+            newImage.setPixel(i,j,qRgb(red, green, blue));
243
+        }
244
+    }
245
+}
246
+
247
+/// \fn string binaryStringToMessage(string binStr)
248
+/// \~English
249
+/// \brief Converts a string of 0's and 1's to a string
250
+///         of characters.
251
+/// Example: with str="10000011000010", returns "AB", because
252
+///          1000001 is ASCII of A, 1000010 is ASCII of B
253
+/// \param str a string of 0's and 1's
254
+/// \return A string that contains the characters whose ASCII codes
255
+///    where specified in the input string.
256
+/// \~Spanish
257
+/// \brief Convierte una cadena de 0's y 1's a una
258
+///         cadena de caracteres.
259
+/// Ejemplo: con str = "10000011000010", devuelve "AB", porque
260
+///          1000001 es ASCII de A, 1000010 es ASCII de B
261
+/// \param str una cadena de 0's y 1's
262
+/// \return  Una cadena que contiene los caracteres cuyos codigos ASCII
263
+///     estaban especificados en la cadena de entrada.
264
+///
265
+string binaryStringToMessage(string binStr){
266
+
267
+   // YOUR CODE HERE
268
+
269
+}
270
+
271
+
272
+
273
+/// \fn string ExtractMessage(const QImage &stegoImage)
274
+/// \~English
275
+/// \brief Given an image (stegoImage) with the embedded message and the
276
+/// the number of bits embedded into each pixels colors, will
277
+/// extract the message that is hidden in the least significant
278
+/// bits of the stegoImage.
279
+/// \param stegoImage image that contains the embeded message
280
+/// \return A string containing the extracted message.
281
+/// \~Spanish
282
+/// \brief Dada una imagen (stegoImage) con un mensaje embedido y el numero
283
+/// numero de bits embedidios en cada color de los pixeles, va a extraer
284
+/// el mensaje que esta escondido en los bits menos significativos de la stegoImage
285
+/// \param stegoImage imagen que contiene el mensaje embedido
286
+/// \return Una cadena conteniendo el mensaje extraido.
287
+///
288
+string ExtractMessage(const QImage &stegoImage){
289
+
290
+    // YOUR CODE HERE
291
+
292
+}

+ 148
- 0
steganography.h View File

@@ -0,0 +1,148 @@
1
+#ifndef STEGANOGRAPHY_H
2
+#define STEGANOGRAPHY_H
3
+#include <string>
4
+#include <QImage>
5
+#include <cmath>
6
+#include <iostream>
7
+
8
+using namespace std ;
9
+
10
+class Steganography
11
+{
12
+public:
13
+    Steganography();
14
+
15
+};
16
+
17
+//number of bits used to represent a letter
18
+const int bitsPerLetter = 8;
19
+
20
+/// \fn string decToBin(int num, int pad)
21
+/// \~English
22
+/// \brief Converts an decimal number to a string in base 2.
23
+/// \param num a non-negative integer, the number that will be converted
24
+/// \param pad a non-negative integer, the number of digits
25
+///             in the resulting string
26
+/// \return A string of length pad of 0's and/or 1's.
27
+/// \~Spanish
28
+/// \brief Convierte un numero entero a una cadena de caracteres
29
+///                 en base 2.
30
+/// \param num un entero positivo, el numero que se va a convertir.
31
+/// \param pad un entero positivo, el numero de digitos en la cadena de
32
+///             caracteres resultante.
33
+/// \return Una cadena de caracteres de largo pad de 0's y/o 1's
34
+///
35
+string decToBin(int num, int pad) ;
36
+
37
+/// \fn string messageToBinaryString(string str)
38
+/// \~English
39
+/// \brief Converts a string to a string of 1's and 0's
40
+/// that represent the ASCII codes of the characters in the original string.
41
+/// For example, "AB" results in "10000011000010".
42
+///                               [-----][-----]
43
+///                                  ^      ^
44
+///                 ASCII code of A  |      |
45
+///                 ASCII code of B --------+
46
+///
47
+/// \param str a string of characters to be converted to their ASCII representations
48
+/// \return A string of 0's and/or 1's.
49
+/// \~Spanish
50
+/// \brief Convierte una caena de caracteres a una cadena de 1's y 0's
51
+/// que representa el codigo ASCII de los caracteren en la cadena original.
52
+/// Por ejemplo, "AB" resulta in "10000011000010".
53
+///                               [-----][-----]
54
+///                                  ^      ^
55
+///              Codigo ASCII  de A  |      |
56
+///              Codigo ASCII  de B --------+
57
+/// \param str una cadena de caracteres a ser convertido a su representacion ASCII
58
+/// \return Una cadena de 0's y/o 1's.
59
+///
60
+string messageToBinaryString(string str) ;
61
+
62
+/// \fn char binStringToChar(string str)
63
+/// \~English
64
+/// \brief binStringToChar: Converts a string of 0's and 1's to a character
65
+/// Example, with str="0011", returns the caracter 3.///
66
+/// \param str: a string of 0's and 1's
67
+/// \return A character whose binary representation is equivalent
68
+///    to the string.
69
+/// \~Spanish
70
+/// \brief Convierte una cadena de 0's y 1's a un caracter.
71
+/// Ejemplo, con str="0011", devuelve el caracter 3.
72
+/// \param str una cadena de 0's y 1's
73
+/// \return Un caracter ASCII cuya representacion binaria es equivalente a la cadena str.
74
+///
75
+char binStringToChar(string str) ;
76
+
77
+/// \fn string binaryStringToMessage(string binStr)
78
+/// \~English
79
+/// \brief Converts a string of 0's and 1's to a string
80
+///         of characters.
81
+/// Example: with str="10000011000010", returns "AB", because
82
+///          1000001 is ASCII of A, 1000010 is ASCII of B
83
+/// \param str a string of 0's and 1's
84
+/// \return A string that contains the characters whose ASCII codes
85
+///    where specified in the input string.
86
+/// \~Spanish
87
+/// \brief Convierte una cadena de 0's y 1's a una
88
+///         cadena de caracteres.
89
+/// Ejemplo: con str = "10000011000010", devuelve "AB", porque
90
+///          1000001 es ASCII de A, 1000010 es ASCII de B
91
+/// \param str una cadena de 0's y 1's
92
+/// \return  Una cadena que contiene los caracteres cuyos codigos ASCII
93
+///     estaban especificados en la cadena de entrada.
94
+///
95
+string binaryStringToMessage(string binStr) ;
96
+
97
+/// \fn int createMask(int lbits)
98
+/// \~English
99
+/// \brief Creates a mask of lbit 1's in the least significant positions.
100
+/// Example, with lbits=4, returns the integer 15, which is mask 0x1111.
101
+/// \param lbits a non-negative integer, the number of bits to set to one
102
+/// \return An integer with lbit 1's in the least signicant positions.
103
+/// \~Spanish
104
+/// \brief Crea una mascara de lbit 1's en las posiciones menos significativas.
105
+/// Ejemplo, con lbits=4, devuelve el entero 15, cuya mascara es 0x1111.
106
+/// \param lbits un entero no negativo, el numero de bits a poner en uno.
107
+/// \return Un entero con lbit 1's en las posiciones menos significativas.
108
+///
109
+int createMask(int lbits) ;
110
+
111
+/// \fn EmbbedMessage(const QImage & origImage, QImage & newImage, string msg)
112
+/// \~English
113
+/// \brief Given an image (origImage) will create a new image (&newImage) by
114
+/// embedding the bits of the msg into the least significant bits of
115
+/// pixel colors of the original image.
116
+/// \param origImage the original image will not be modified
117
+/// \param newImage the image that is created
118
+/// \param msg the string that will be embedded
119
+/// \return By reference, the newImage is returned, containing the embedded message
120
+/// \~Spanish
121
+/// \brief Dada una imagen (origImage) creara una imagen nueva(&newImage)
122
+/// empotrando los bits de el mensaje msg en los bits menos significativos de los
123
+/// colores de la imagen original.
124
+/// \param origImage la imagen original no va a ser modificada
125
+/// \param newImage la imagen que se crea
126
+/// \param msg la cadena que va a ser empotrada
127
+/// \return Por referencia, es devuelta newImage, conteniendo el mensaje empotrado.
128
+///
129
+void EmbbedMessage(const QImage &origImage, QImage & newImage, string msg) ;
130
+
131
+/// \fn string ExtractMessage(const QImage &stegoImage)
132
+/// \~English
133
+/// \brief Given an image (stegoImage) with the embedded message and the
134
+/// the number of bits embedded into each pixels colors, will
135
+/// extract the message that is hidden in the least significant
136
+/// bits of the stegoImage.
137
+/// \param stegoImage image that contains the embeded message
138
+/// \return A string containing the extracted message.
139
+/// \~Spanish
140
+/// \brief Dada una imagen (stegoImage) con un mensaje embedido y el numero
141
+/// numero de bits embedidios en cada color de los pixeles, va a extraer
142
+/// el mensaje que esta escondido en los bits menos significativos de la stegoImage
143
+/// \param stegoImage imagen que contiene el mensaje embedido
144
+/// \return Una cadena conteniendo el mensaje extraido.
145
+///
146
+string ExtractMessage(const QImage &stegoImge) ;
147
+
148
+#endif // STEGANOGRAPHY_H

+ 202
- 0
ui_StegaPanel.h View File

@@ -0,0 +1,202 @@
1
+/********************************************************************************
2
+** Form generated from reading UI file 'StegaPanel.ui'
3
+**
4
+** Created by: Qt User Interface Compiler version 5.2.1
5
+**
6
+** WARNING! All changes made in this file will be lost when recompiling UI file!
7
+********************************************************************************/
8
+
9
+#ifndef UI_STEGAPANEL_H
10
+#define UI_STEGAPANEL_H
11
+
12
+#include <QtCore/QVariant>
13
+#include <QtWidgets/QAction>
14
+#include <QtWidgets/QApplication>
15
+#include <QtWidgets/QButtonGroup>
16
+#include <QtWidgets/QHBoxLayout>
17
+#include <QtWidgets/QHeaderView>
18
+#include <QtWidgets/QLabel>
19
+#include <QtWidgets/QMainWindow>
20
+#include <QtWidgets/QMenuBar>
21
+#include <QtWidgets/QPushButton>
22
+#include <QtWidgets/QSpinBox>
23
+#include <QtWidgets/QStatusBar>
24
+#include <QtWidgets/QTextEdit>
25
+#include <QtWidgets/QToolBar>
26
+#include <QtWidgets/QVBoxLayout>
27
+#include <QtWidgets/QWidget>
28
+
29
+QT_BEGIN_NAMESPACE
30
+
31
+class Ui_StegaPanel
32
+{
33
+public:
34
+    QWidget *centralWidget;
35
+    QLabel *old_label;
36
+    QLabel *new_label;
37
+    QLabel *old_image;
38
+    QLabel *new_image;
39
+    QTextEdit *textEdit;
40
+    QLabel *error_msg_label;
41
+    QWidget *layoutWidget;
42
+    QVBoxLayout *verticalLayout;
43
+    QPushButton *loadImage;
44
+    QPushButton *storeImage;
45
+    QWidget *verticalLayoutWidget;
46
+    QVBoxLayout *verticalLayout_3;
47
+    QHBoxLayout *horizontalLayout_2;
48
+    QLabel *label;
49
+    QSpinBox *bitBox;
50
+    QPushButton *hideMessage;
51
+    QPushButton *getMessage;
52
+    QLabel *label_3;
53
+    QMenuBar *menuBar;
54
+    QToolBar *mainToolBar;
55
+    QStatusBar *statusBar;
56
+
57
+    void setupUi(QMainWindow *StegaPanel)
58
+    {
59
+        if (StegaPanel->objectName().isEmpty())
60
+            StegaPanel->setObjectName(QStringLiteral("StegaPanel"));
61
+        StegaPanel->resize(1055, 625);
62
+        centralWidget = new QWidget(StegaPanel);
63
+        centralWidget->setObjectName(QStringLiteral("centralWidget"));
64
+        old_label = new QLabel(centralWidget);
65
+        old_label->setObjectName(QStringLiteral("old_label"));
66
+        old_label->setGeometry(QRect(220, 10, 91, 21));
67
+        new_label = new QLabel(centralWidget);
68
+        new_label->setObjectName(QStringLiteral("new_label"));
69
+        new_label->setGeometry(QRect(750, 10, 81, 16));
70
+        old_image = new QLabel(centralWidget);
71
+        old_image->setObjectName(QStringLiteral("old_image"));
72
+        old_image->setGeometry(QRect(20, 40, 501, 401));
73
+        old_image->setBaseSize(QSize(0, 0));
74
+        old_image->setFrameShape(QFrame::StyledPanel);
75
+        old_image->setScaledContents(true);
76
+        new_image = new QLabel(centralWidget);
77
+        new_image->setObjectName(QStringLiteral("new_image"));
78
+        new_image->setGeometry(QRect(540, 40, 501, 401));
79
+        new_image->setFrameShape(QFrame::StyledPanel);
80
+        new_image->setScaledContents(true);
81
+        textEdit = new QTextEdit(centralWidget);
82
+        textEdit->setObjectName(QStringLiteral("textEdit"));
83
+        textEdit->setGeometry(QRect(310, 460, 411, 91));
84
+        error_msg_label = new QLabel(centralWidget);
85
+        error_msg_label->setObjectName(QStringLiteral("error_msg_label"));
86
+        error_msg_label->setGeometry(QRect(250, 571, 581, 20));
87
+        layoutWidget = new QWidget(centralWidget);
88
+        layoutWidget->setObjectName(QStringLiteral("layoutWidget"));
89
+        layoutWidget->setGeometry(QRect(77, 460, 171, 66));
90
+        verticalLayout = new QVBoxLayout(layoutWidget);
91
+        verticalLayout->setSpacing(6);
92
+        verticalLayout->setContentsMargins(11, 11, 11, 11);
93
+        verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
94
+        verticalLayout->setContentsMargins(0, 0, 0, 0);
95
+        loadImage = new QPushButton(layoutWidget);
96
+        loadImage->setObjectName(QStringLiteral("loadImage"));
97
+
98
+        verticalLayout->addWidget(loadImage);
99
+
100
+        storeImage = new QPushButton(layoutWidget);
101
+        storeImage->setObjectName(QStringLiteral("storeImage"));
102
+
103
+        verticalLayout->addWidget(storeImage);
104
+
105
+        verticalLayoutWidget = new QWidget(centralWidget);
106
+        verticalLayoutWidget->setObjectName(QStringLiteral("verticalLayoutWidget"));
107
+        verticalLayoutWidget->setGeometry(QRect(760, 460, 181, 106));
108
+        verticalLayout_3 = new QVBoxLayout(verticalLayoutWidget);
109
+        verticalLayout_3->setSpacing(6);
110
+        verticalLayout_3->setContentsMargins(11, 11, 11, 11);
111
+        verticalLayout_3->setObjectName(QStringLiteral("verticalLayout_3"));
112
+        verticalLayout_3->setContentsMargins(0, 0, 0, 0);
113
+        horizontalLayout_2 = new QHBoxLayout();
114
+        horizontalLayout_2->setSpacing(6);
115
+        horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2"));
116
+        label = new QLabel(verticalLayoutWidget);
117
+        label->setObjectName(QStringLiteral("label"));
118
+
119
+        horizontalLayout_2->addWidget(label);
120
+
121
+        bitBox = new QSpinBox(verticalLayoutWidget);
122
+        bitBox->setObjectName(QStringLiteral("bitBox"));
123
+        bitBox->setMinimum(1);
124
+        bitBox->setMaximum(8);
125
+
126
+        horizontalLayout_2->addWidget(bitBox);
127
+
128
+
129
+        verticalLayout_3->addLayout(horizontalLayout_2);
130
+
131
+        hideMessage = new QPushButton(verticalLayoutWidget);
132
+        hideMessage->setObjectName(QStringLiteral("hideMessage"));
133
+
134
+        verticalLayout_3->addWidget(hideMessage);
135
+
136
+        getMessage = new QPushButton(verticalLayoutWidget);
137
+        getMessage->setObjectName(QStringLiteral("getMessage"));
138
+
139
+        verticalLayout_3->addWidget(getMessage);
140
+
141
+        label_3 = new QLabel(centralWidget);
142
+        label_3->setObjectName(QStringLiteral("label_3"));
143
+        label_3->setGeometry(QRect(800, 550, 99, 29));
144
+        QFont font;
145
+        font.setPointSize(9);
146
+        label_3->setFont(font);
147
+        StegaPanel->setCentralWidget(centralWidget);
148
+        layoutWidget->raise();
149
+        old_label->raise();
150
+        new_label->raise();
151
+        old_image->raise();
152
+        new_image->raise();
153
+        textEdit->raise();
154
+        error_msg_label->raise();
155
+        verticalLayoutWidget->raise();
156
+        label_3->raise();
157
+        menuBar = new QMenuBar(StegaPanel);
158
+        menuBar->setObjectName(QStringLiteral("menuBar"));
159
+        menuBar->setGeometry(QRect(0, 0, 1055, 22));
160
+        StegaPanel->setMenuBar(menuBar);
161
+        mainToolBar = new QToolBar(StegaPanel);
162
+        mainToolBar->setObjectName(QStringLiteral("mainToolBar"));
163
+        StegaPanel->addToolBar(Qt::TopToolBarArea, mainToolBar);
164
+        statusBar = new QStatusBar(StegaPanel);
165
+        statusBar->setObjectName(QStringLiteral("statusBar"));
166
+        StegaPanel->setStatusBar(statusBar);
167
+
168
+        retranslateUi(StegaPanel);
169
+
170
+        QMetaObject::connectSlotsByName(StegaPanel);
171
+    } // setupUi
172
+
173
+    void retranslateUi(QMainWindow *StegaPanel)
174
+    {
175
+        StegaPanel->setWindowTitle(QApplication::translate("StegaPanel", "Steganography", 0));
176
+        old_label->setText(QApplication::translate("StegaPanel", "Original Image", 0));
177
+        new_label->setText(QApplication::translate("StegaPanel", "Stego Image", 0));
178
+        old_image->setText(QString());
179
+        new_image->setText(QString());
180
+        textEdit->setHtml(QApplication::translate("StegaPanel", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
181
+"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
182
+"p, li { white-space: pre-wrap; }\n"
183
+"</style></head><body style=\" font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;\">\n"
184
+"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>", 0));
185
+        error_msg_label->setText(QString());
186
+        loadImage->setText(QApplication::translate("StegaPanel", "Load Image", 0));
187
+        storeImage->setText(QApplication::translate("StegaPanel", "Store New Image", 0));
188
+        label->setText(QApplication::translate("StegaPanel", "Number of Bits :", 0));
189
+        hideMessage->setText(QApplication::translate("StegaPanel", "Hide Message", 0));
190
+        getMessage->setText(QApplication::translate("StegaPanel", "Retrieve Message", 0));
191
+        label_3->setText(QApplication::translate("StegaPanel", "(from Original Image)", 0));
192
+    } // retranslateUi
193
+
194
+};
195
+
196
+namespace Ui {
197
+    class StegaPanel: public Ui_StegaPanel {};
198
+} // namespace Ui
199
+
200
+QT_END_NAMESPACE
201
+
202
+#endif // UI_STEGAPANEL_H

+ 202
- 0
ui_panel.h View File

@@ -0,0 +1,202 @@
1
+/********************************************************************************
2
+** Form generated from reading UI file 'StegaPanel.ui'
3
+**
4
+** Created by: Qt User Interface Compiler version 5.2.1
5
+**
6
+** WARNING! All changes made in this file will be lost when recompiling UI file!
7
+********************************************************************************/
8
+
9
+#ifndef UI_STEGAPANEL_H
10
+#define UI_STEGAPANEL_H
11
+
12
+#include <QtCore/QVariant>
13
+#include <QtWidgets/QAction>
14
+#include <QtWidgets/QApplication>
15
+#include <QtWidgets/QButtonGroup>
16
+#include <QtWidgets/QHBoxLayout>
17
+#include <QtWidgets/QHeaderView>
18
+#include <QtWidgets/QLabel>
19
+#include <QtWidgets/QMainWindow>
20
+#include <QtWidgets/QMenuBar>
21
+#include <QtWidgets/QPushButton>
22
+#include <QtWidgets/QSpinBox>
23
+#include <QtWidgets/QStatusBar>
24
+#include <QtWidgets/QTextEdit>
25
+#include <QtWidgets/QToolBar>
26
+#include <QtWidgets/QVBoxLayout>
27
+#include <QtWidgets/QWidget>
28
+
29
+QT_BEGIN_NAMESPACE
30
+
31
+class Ui_StegaPanel
32
+{
33
+public:
34
+    QWidget *centralWidget;
35
+    QLabel *old_label;
36
+    QLabel *new_label;
37
+    QLabel *old_image;
38
+    QLabel *new_image;
39
+    QTextEdit *textEdit;
40
+    QLabel *error_msg_label;
41
+    QWidget *layoutWidget;
42
+    QVBoxLayout *verticalLayout;
43
+    QPushButton *loadImage;
44
+    QPushButton *storeImage;
45
+    QWidget *verticalLayoutWidget;
46
+    QVBoxLayout *verticalLayout_3;
47
+    QHBoxLayout *horizontalLayout_2;
48
+    QLabel *label;
49
+    QSpinBox *bitBox;
50
+    QPushButton *hideMessage;
51
+    QPushButton *getMessage;
52
+    QLabel *label_3;
53
+    QMenuBar *menuBar;
54
+    QToolBar *mainToolBar;
55
+    QStatusBar *statusBar;
56
+
57
+    void setupUi(QMainWindow *StegaPanel)
58
+    {
59
+        if (StegaPanel->objectName().isEmpty())
60
+            StegaPanel->setObjectName(QStringLiteral("StegaPanel"));
61
+        StegaPanel->resize(1055, 625);
62
+        centralWidget = new QWidget(StegaPanel);
63
+        centralWidget->setObjectName(QStringLiteral("centralWidget"));
64
+        old_label = new QLabel(centralWidget);
65
+        old_label->setObjectName(QStringLiteral("old_label"));
66
+        old_label->setGeometry(QRect(220, 10, 91, 21));
67
+        new_label = new QLabel(centralWidget);
68
+        new_label->setObjectName(QStringLiteral("new_label"));
69
+        new_label->setGeometry(QRect(750, 10, 81, 16));
70
+        old_image = new QLabel(centralWidget);
71
+        old_image->setObjectName(QStringLiteral("old_image"));
72
+        old_image->setGeometry(QRect(20, 40, 501, 401));
73
+        old_image->setBaseSize(QSize(0, 0));
74
+        old_image->setFrameShape(QFrame::StyledPanel);
75
+        old_image->setScaledContents(true);
76
+        new_image = new QLabel(centralWidget);
77
+        new_image->setObjectName(QStringLiteral("new_image"));
78
+        new_image->setGeometry(QRect(540, 40, 501, 401));
79
+        new_image->setFrameShape(QFrame::StyledPanel);
80
+        new_image->setScaledContents(true);
81
+        textEdit = new QTextEdit(centralWidget);
82
+        textEdit->setObjectName(QStringLiteral("textEdit"));
83
+        textEdit->setGeometry(QRect(310, 460, 411, 91));
84
+        error_msg_label = new QLabel(centralWidget);
85
+        error_msg_label->setObjectName(QStringLiteral("error_msg_label"));
86
+        error_msg_label->setGeometry(QRect(250, 571, 581, 20));
87
+        layoutWidget = new QWidget(centralWidget);
88
+        layoutWidget->setObjectName(QStringLiteral("layoutWidget"));
89
+        layoutWidget->setGeometry(QRect(77, 460, 171, 66));
90
+        verticalLayout = new QVBoxLayout(layoutWidget);
91
+        verticalLayout->setSpacing(6);
92
+        verticalLayout->setContentsMargins(11, 11, 11, 11);
93
+        verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
94
+        verticalLayout->setContentsMargins(0, 0, 0, 0);
95
+        loadImage = new QPushButton(layoutWidget);
96
+        loadImage->setObjectName(QStringLiteral("loadImage"));
97
+
98
+        verticalLayout->addWidget(loadImage);
99
+
100
+        storeImage = new QPushButton(layoutWidget);
101
+        storeImage->setObjectName(QStringLiteral("storeImage"));
102
+
103
+        verticalLayout->addWidget(storeImage);
104
+
105
+        verticalLayoutWidget = new QWidget(centralWidget);
106
+        verticalLayoutWidget->setObjectName(QStringLiteral("verticalLayoutWidget"));
107
+        verticalLayoutWidget->setGeometry(QRect(760, 460, 181, 106));
108
+        verticalLayout_3 = new QVBoxLayout(verticalLayoutWidget);
109
+        verticalLayout_3->setSpacing(6);
110
+        verticalLayout_3->setContentsMargins(11, 11, 11, 11);
111
+        verticalLayout_3->setObjectName(QStringLiteral("verticalLayout_3"));
112
+        verticalLayout_3->setContentsMargins(0, 0, 0, 0);
113
+        horizontalLayout_2 = new QHBoxLayout();
114
+        horizontalLayout_2->setSpacing(6);
115
+        horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2"));
116
+        label = new QLabel(verticalLayoutWidget);
117
+        label->setObjectName(QStringLiteral("label"));
118
+
119
+        horizontalLayout_2->addWidget(label);
120
+
121
+        bitBox = new QSpinBox(verticalLayoutWidget);
122
+        bitBox->setObjectName(QStringLiteral("bitBox"));
123
+        bitBox->setMinimum(1);
124
+        bitBox->setMaximum(8);
125
+
126
+        horizontalLayout_2->addWidget(bitBox);
127
+
128
+
129
+        verticalLayout_3->addLayout(horizontalLayout_2);
130
+
131
+        hideMessage = new QPushButton(verticalLayoutWidget);
132
+        hideMessage->setObjectName(QStringLiteral("hideMessage"));
133
+
134
+        verticalLayout_3->addWidget(hideMessage);
135
+
136
+        getMessage = new QPushButton(verticalLayoutWidget);
137
+        getMessage->setObjectName(QStringLiteral("getMessage"));
138
+
139
+        verticalLayout_3->addWidget(getMessage);
140
+
141
+        label_3 = new QLabel(centralWidget);
142
+        label_3->setObjectName(QStringLiteral("label_3"));
143
+        label_3->setGeometry(QRect(800, 550, 99, 29));
144
+        QFont font;
145
+        font.setPointSize(9);
146
+        label_3->setFont(font);
147
+        StegaPanel->setCentralWidget(centralWidget);
148
+        layoutWidget->raise();
149
+        old_label->raise();
150
+        new_label->raise();
151
+        old_image->raise();
152
+        new_image->raise();
153
+        textEdit->raise();
154
+        error_msg_label->raise();
155
+        verticalLayoutWidget->raise();
156
+        label_3->raise();
157
+        menuBar = new QMenuBar(StegaPanel);
158
+        menuBar->setObjectName(QStringLiteral("menuBar"));
159
+        menuBar->setGeometry(QRect(0, 0, 1055, 22));
160
+        StegaPanel->setMenuBar(menuBar);
161
+        mainToolBar = new QToolBar(StegaPanel);
162
+        mainToolBar->setObjectName(QStringLiteral("mainToolBar"));
163
+        StegaPanel->addToolBar(Qt::TopToolBarArea, mainToolBar);
164
+        statusBar = new QStatusBar(StegaPanel);
165
+        statusBar->setObjectName(QStringLiteral("statusBar"));
166
+        StegaPanel->setStatusBar(statusBar);
167
+
168
+        retranslateUi(StegaPanel);
169
+
170
+        QMetaObject::connectSlotsByName(StegaPanel);
171
+    } // setupUi
172
+
173
+    void retranslateUi(QMainWindow *StegaPanel)
174
+    {
175
+        StegaPanel->setWindowTitle(QApplication::translate("StegaPanel", "Steganography", 0));
176
+        old_label->setText(QApplication::translate("StegaPanel", "Original Image", 0));
177
+        new_label->setText(QApplication::translate("StegaPanel", "Stego Image", 0));
178
+        old_image->setText(QString());
179
+        new_image->setText(QString());
180
+        textEdit->setHtml(QApplication::translate("StegaPanel", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
181
+"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
182
+"p, li { white-space: pre-wrap; }\n"
183
+"</style></head><body style=\" font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;\">\n"
184
+"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>", 0));
185
+        error_msg_label->setText(QString());
186
+        loadImage->setText(QApplication::translate("StegaPanel", "Load Image", 0));
187
+        storeImage->setText(QApplication::translate("StegaPanel", "Store New Image", 0));
188
+        label->setText(QApplication::translate("StegaPanel", "Number of Bits :", 0));
189
+        hideMessage->setText(QApplication::translate("StegaPanel", "Hide Message", 0));
190
+        getMessage->setText(QApplication::translate("StegaPanel", "Retrieve Message", 0));
191
+        label_3->setText(QApplication::translate("StegaPanel", "(from Original Image)", 0));
192
+    } // retranslateUi
193
+
194
+};
195
+
196
+namespace Ui {
197
+    class StegaPanel: public Ui_StegaPanel {};
198
+} // namespace Ui
199
+
200
+QT_END_NAMESPACE
201
+
202
+#endif // UI_STEGAPANEL_H