{"id":15477666,"url":"https://github.com/aagarwal1012/image-steganography-library-android","last_synced_at":"2025-04-09T19:21:12.879Z","repository":{"id":38383581,"uuid":"133466276","full_name":"aagarwal1012/Image-Steganography-Library-Android","owner":"aagarwal1012","description":"✔️ Hide a secret message in an image","archived":false,"fork":false,"pushed_at":"2024-07-12T21:35:14.000Z","size":9304,"stargazers_count":154,"open_issues_count":8,"forks_count":61,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-10-30T08:18:31.716Z","etag":null,"topics":["android-library","hacktoberfest","image-steganography","image-steganography-library-android","lsb","steganography","text-encodings"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aagarwal1012.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"patreon":"aagarwal1012","custom":"https://www.paypal.me/aagarwal1012"}},"created_at":"2018-05-15T05:58:39.000Z","updated_at":"2024-10-29T09:34:29.000Z","dependencies_parsed_at":"2024-10-30T06:34:30.585Z","dependency_job_id":null,"html_url":"https://github.com/aagarwal1012/Image-Steganography-Library-Android","commit_stats":{"total_commits":86,"total_committers":6,"mean_commits":"14.333333333333334","dds":"0.11627906976744184","last_synced_commit":"95e34954b621b79c7d026fc43f4938dc05be79ff"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aagarwal1012%2FImage-Steganography-Library-Android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aagarwal1012%2FImage-Steganography-Library-Android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aagarwal1012%2FImage-Steganography-Library-Android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aagarwal1012%2FImage-Steganography-Library-Android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aagarwal1012","download_url":"https://codeload.github.com/aagarwal1012/Image-Steganography-Library-Android/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248095155,"owners_count":21046799,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android-library","hacktoberfest","image-steganography","image-steganography-library-android","lsb","steganography","text-encodings"],"created_at":"2024-10-02T04:01:17.838Z","updated_at":"2025-04-09T19:21:12.855Z","avatar_url":"https://github.com/aagarwal1012.png","language":"Java","funding_links":["https://patreon.com/aagarwal1012","https://www.paypal.me/aagarwal1012","https://www.paypal.me/aagarwal1012/"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\u003cimg src=\"https://github.com/aagarwal1012/Image-Steganography-Library-Android/blob/master/images/cover.png?raw=true\"/\u003e\u003c/div\u003e  \n\u003cdiv align= \"center\"\u003e\n\t\u003cimg src=\"https://img.shields.io/badge/platform-Android-brightgreen.svg\" alt=\"Platform\" /\u003e\n\t\n\u003cimg src=\"https://img.shields.io/badge/API-16%2B-blue.svg\" alt=\"API\" /\u003e \n\t\n\u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/License-MIT-red.svg\"\n      alt=\"License: MIT\" /\u003e\n  \u003c/a\u003e\n\t\u003ca href=\"https://jitpack.io/#aagarwal1012/Image-Steganography-Library-Android\"\u003e\u003cimg src=\"https://jitpack.io/v/aagarwal1012/Image-Steganography-Library-Android.svg\" alt=\"version\" /\u003e\u003c/a\u003e\n\t\u003ca href=\"https://www.paypal.me/aagarwal1012\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Donate-PayPal-green.svg\"\n      alt=\"Donate\" /\u003e\n  \u003c/a\u003e\n\t\n\u003c/div\u003e\n\n# Image Steganography\nSteganography is the process of hiding a secret message within a larger one in such a way that someone  cannot know the presence or contents of the hidden message. Although related, Steganography is not to be confused with Encryption, which is the process of making a message unintelligible—Steganography attempts to hide the existence of communication.\nThe main advantage of steganography algorithm is because of its simple security mechanism. Because the steganographic message is integrated invisibly and covered inside other harmless sources, it is very difficult to detect the message without knowing\nthe existence and the appropriate encoding scheme .\n\n# Proposed Algorithm\nThe algorithm is more dedicated towards the algorithm proposed by Rosziati Ibrahim and Teoh Suk Kuan in their [Research Paper](https://arxiv.org/ftp/arxiv/papers/1112/1112.2809.pdf) published on February 25, 2011.\n## Encoding Algorithm\n- Firstly, the secret message that is extracted is `compressed` as the contents in the compressed string will significantly hard to detect and read, furthermore it reduces the size of string.\n- Secondly, the compressed string is `encrypted` with the secret key.\n- Finally, `encoding` the encrypted message in the image. It uses `LSB steganographic embedding` to encode data into an image. Once the message is encoded the process stops.\n### LSB(Least Significant Bit) Embedding\nThe LSB is the lowest significant bit in the byte value of the image pixel.\nThe  LSB  based  image  steganography  embeds  the  secret  in the  least  significant  bits  of  pixel  values  of  the  cover  image (CVR).\nThe concept of LSB Embedding is simple. It exploits the fact that the level of precision in many image formats is far greater than that perceivable by average human vision. Therefore, an altered image with slight variations in its colors will be indistinguishable from the original by a human being, just by looking at it. In conventional LSB technique, which requires eight bytes of pixels to store 1byte of secret data but in proposed LSB technique, just four bytes of pixels are sufficient to hold one message byte. Rest of the bits in the pixels remains the same.\nFollowing shows the bit level interpretation of the algorithm :  \n\u003cdiv align=\"center\"\u003e\u003cimg src=\"/images/lsb1.png\"/\u003e\u003c/div\u003e\n\n## Decoding Algorithm\n- Firstly, `decode` the message from the encrypted image using LSB decoding.\n\n- Secondly, `decrypt` the compressed message from the decoded message using the secret key.\n\n- Finally, `decompress` the message to get the original compressed message.   \n\nConsider the following encoding, it is totally undetectable by human eyes.\n\u003cdiv align=\"center\"\u003e\u003cimg src=\"/images/original_encoded.png\"/\u003e\u003c/div\u003e\n\n# Usage\nAdd it in your root `build.gradle` at the end of repositories:\n```groovy\nallprojects {\n\trepositories {\n\t\t...\n\t\tmaven { url 'https://jitpack.io' }\n\t}\n}\n```\nNow add the following dependency in your app's `build.gradle`\n```groovy\ndependencies {\n      implementation 'com.github.aagarwal1012:Image-Steganography-Library-Android:v1.0'\n}\n```\n## How to encode message into an image ?\n**Note :** Your Activity class should implements `TextEncodingCallback` interface and also contains its `override` methods.\n\n```java\npublic class MainActivity extends AppCompatActivity implements TextEncodingCallback \n```\n- Firstly, instantiate the `ImageSteganography` object and pass the values `Message\t`, `Secret Key` and `Image Bitmap` to the constructor.\n\n  ```java\n  ImageSteganography imageSteganography = new ImageSteganography(message, \n                                          secret_key, \n                                          original_image);\n  ```\n\n- Secondly, instantiate the `TextEncoding` object and pass the values `Activity` and `TextEncodingCallback` object to the constructor.\n\n  ```java\n  TextEncoding textEncoding = new TextEncoding(MainActivity.this,\n                              MainActivity.this);\n  ```\n\n- Finally, execute our `encoding` task.\n\n  ```java\n  textEncoding.execute(imageSteganography);\n  ```\n**Note** : By default a `ProgressDialog` will appear in the process of text encoding.\n\n#### Override Methods\n\n- `OnStartTextEncoding()` : In this method you can whatever by the start of text encoding process.  \n\n  ```java\n  @Override\n      public void onStartTextEncoding() {\n          //Whatever you want to do at the start of text encoding\n      }\n  ```\n\n- `onCompleteTextEncoding()` : After the completion of text encoding, this method is called and gives result.\n\n  ```java\n  @Override\n      public void onCompleteTextEncoding(ImageSteganography result) {\n  \n          //After the completion of text encoding.\n          \n          //result object is instantiated \n          this.result = result;\n  \n          if (result != null \u0026\u0026 result.isEncoded()){\n              \n              //encrypted image bitmap is extracted from result object\n              encoded_image = result.getEncrypted_image();\n              \n              //set text and image to the UI component.\n              textView.setText(\"Encoded\");\n              imageView.setImageBitmap(encoded_image);\n      }\n  ```\n## How to decode message from an image ?\n**Note :** Your Activity class should implements `TextDecodingCallback` interface and also contains its `override` methods.\n\n```java\npublic class MainActivity extends AppCompatActivity implements TextDecodingCallback \n```\n- Firstly, instantiate the `ImageSteganography` object and pass the values `Secret Key` and `Image Bitmap` to the constructor.\n\n  ```java\n  ImageSteganography imageSteganography = new ImageSteganography(secret_key,\n                                          original_image);\n  ```\n\n- Secondly, instantiate the `TextDecoding` object and pass the values `Activity` and `TextDecodingCallback` object to the constructor.\n\n  ```java\n  TextDecoding textDecoding = new TextDecoding(MainActivity.this, \n                              MainActivity.this);\n  ```\n\n- Finally, execute our `decoding` task.\n\n  ```java\n  textDecoding.execute(imageSteganography);\n  ```\n  **Note** : By default a `ProgressDialog` will appear in the process of text decoding.\n\n#### Override Methods\n\n- `OnStartTextDecoding()` : In this method you can whatever by the start of text decoding process.  \n\n  ```java\n  @Override\n      public void onStartTextDecoding() {\n          //Whatever you want to do at the start of text encoding\n      }\n  ```\n\n- `onCompleteTextDecoding()` : After the completion of text decoding, this method is called and gives result.\n\n  ```java\n  @Override\n      public void onCompleteTextEncoding(ImageSteganography result) {\n  \n          //After the completion of text encoding.\n          \n          //result object is instantiated \n          this.result = result;\n  \n          if (result != null){\n              \n              /* If result.isDecoded() is false, it means no Message was found in \t\t\t\t\tthe image. */\n              if (!result.isDecoded())\n                  textView.setText(\"No message found\");\n              \n              else{\n                  /* If result.isSecretKeyWrong() is true, it means that secret key provided \t\t\t\tis wrong. */ \n                  if (!result.isSecretKeyWrong()){\n                      //set the message to the UI component.\n                      textView.setText(\"Decoded\");\n                      message.setText(\"\" + result.getMessage());\n                  }\n                  else {\n                      textView.setText(\"Wrong secret key\");\n                  }\n              }\n          }\n          else {\n              //If result is null it means that bitmap is null\n              textView.setText(\"Select Image First\");\n          }\n      }\n  ```\n# Documentation\n\n#### ImageSteganography Class\n\n| Java attribute     | Java set methods                | Description                                                  | Default Value |\n| :---------------- | :------------------------------ | :----------------------------------------------------------- | :-----------: |\n| Message | setMessage(...) , getMessage() | Set the value of message, Get the value of message. | Null      |\n| Secret_Key | setSecret_key(...) | Set the value of secret key. | Null      |\n| Image  | setImage(...) | Set the value of image.              | Null      |\n| Encoded_Image | getEncoded_image() | Get the value of encoded image after text encoding. | Null       |\n| Encoded | isEncoded() | Check that the encoding is over or not | false       |\n| Decoded | isDecoded() | Check that the decoding is over or not. | false       |\n| SecretKeyWrong | isSecretKeyWrong() | Check that the secret key provided was right or wrong but after decoding was done. | true     |\n\n#### Class Domain Diagram\n\n![](https://raw.githubusercontent.com/aagarwal1012/Image-Steganography-Library-Android/master/UML/UMLDOC.PNG)\n\n### Example App\n\nThere are two options `Encode` and `Decode`. In the encode section you can hide a secret message into an image without making any noticeable changes. In the decode section you can extract the message from the encoded image by inserting the correct key.\n\n**Note** - After pressing the `Save` button, both the original and encoded images are saved at the location ```Android/data/com.ayush.steganography/files/Documents/\u003cUUID\u003e/ ```\n\n|                            Encode                            |                            Decode                            |\n| :----------------------------------------------------------: | :----------------------------------------------------------: |\n| \u003cimg src=\"https://github.com/aagarwal1012/Image-Steganography-Library-Android/blob/master/images/encode.gif\" height = \"500px\"/\u003e | \u003cimg src=\"https://github.com/aagarwal1012/Image-Steganography-Library-Android/blob/master/images/decode.gif\" height = \"500px\"/\u003e |\n# Want to contribute !\n\nThis is the well `documented` library. I have documented each and every method that I have used, so have a good read to the code and suggest some changes and new feature to be added in the library.  \nFeel free to \u003ca href = \"https://github.com/aagarwal1012/Image-Steganography-Library-Android/issues\"\u003eopen an issue\u003c/a\u003e.\n\n# Donate\n\u003e If you found this project helpful or you learned something from the source code and want to thank me, consider buying me a cup of :coffee:\n\u003e\n\u003e - [PayPal](https://www.paypal.me/aagarwal1012/)\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/rhayes2\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/43277456?v=4\" width=\"100px;\" alt=\"Ryan Hayes\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eRyan Hayes\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#maintenance-rhayes2\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e \u003ca href=\"#ideas-rhayes2\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e \u003ca href=\"https://github.com/aagarwal1012/Image-Steganography-Library-Android/issues?q=author%3Arhayes2\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n\n# License\n**Image Steganography** is licensed under `MIT license`.\n\n```\nMIT License\n\nCopyright (c) 2018 Ayush Agarwal\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faagarwal1012%2Fimage-steganography-library-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faagarwal1012%2Fimage-steganography-library-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faagarwal1012%2Fimage-steganography-library-android/lists"}