Nav apraksta

steganography.h 6.1KB

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