Code Monkey home page Code Monkey logo

lsb-steganography-javascript's Introduction

LSB-steganography-javascript

LSB(Least Significant Bit) method for steganography using javascript.

Demo

Demo(follow step by step) - https://jsfiddle.net/norlihazmeyGhazali/quo42a2n/ - tested on .txt file

Consist of 5 steps :

  1. Select secret data .txt files
  2. Select cover image
  3. Click hide button
    • this time, both cover image before and after rendered inside canvas element
  4. Save cover image(contain secret data). Right click and save into your pc
  5. Select again the saved file and it automatically download .txt file containing your secret data(data maybe not accurated as original form.....as for now..)

How it works

The main important concept in steganography is hiding secret information inside image without decreased image quality. This image react as a cover and at the same time, your secret data is hiding inside. You can send those image to someone, and the one who received this image will use same tools to extract/get the data back into original form.

Internally, the secret data's binary bit was used and replacing the cover image pixel's bit. The replacing occured on the Lease Significant Bit also known as LSB which remove or clear first two bits from cover image's pixel and replaced with secret data. Only first two bits were used in order to retain the quality of cover image. See below how the replacing bits occured :

The binary used here is just for an example for illustration purpose :

Secret Data byte(a) : 1101 0110

Cover image rgba(b) : 0110 11011, 1100 0011, 1111 0011, 0000 1010

  1. Internally, the first two bits(b) for every pixel's byte was set into 0(clear), and become like this :
 0110 11000, 1100 0000, 1111 0000, 0000 1000
         ^^         ^^         ^^         ^^
         |          |          |          |
         \          |          |          /
           \        |          |         /
             \      |          |        /
                  clear bit(set to 0)
  1. Take 2 bits of (a) from left(right hand) to the right(left hand)
                (right) 1101 0110 (left) - Secret Data
                
         10         01         01         11
         ||         ||         ||         ||
 0110 11000, 1100 0000, 1111 0000, 0000 1000
         ^^         ^^         ^^         ^^
         |          |          |          |
         \          |          |          /
           \        |          |         /
             \      |          |        /
                  and become like below
0110 11010, 1100 0001, 1111 0001, 0000 1011

Quality of cover image still acceptable unless the replacing occured at the highest nibble(bits 4-7) instead of lowest nibble(bits 0-3).

Super Duper Important Reminders/Notes

  1. Please do not select/choose .txt file containing too much data inside, as it may bloated/slow down your pc's performance as its need more resources to operate/iterate every bits/bytes for each data.
  2. Select only .txt file, others may/maybe not works
  3. Data extracted from image still 100% not accurated,, depends on file size and data inside.
  4. Only test with chrome 57.0.2987.133. Others browser may or may not works.
  5. Fork if you found it useful and want to contribute to it, ohh pleaseee.....
  6. This lib still in development mode :)

lsb-steganography-javascript's People

Contributors

metallurgical avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.