Jun 4 / Cyb3r

Cryptography and Steganography with Python

Basic definitions

Cryptography is the practice and study of hiding information. The word is a combination of the GreekKryptos(hidden) and gráphō  (I write)

Steganography is the art and science of writing hidden messages in such a way that no one, apart from the sender and intended recipient, suspects the existence of the message, a form of security through obscurity. The word steganography is of Greek origin and means “concealed writing” from the Greek words steganos (στεγανός) meaning “covered or protected”, and graphein (γράφειν) meaning “to write”.

Setting up libraries

Practically all Linux distributions will have python insdtalled, or available as installable packages.

Now other libraries for the task

  1. stepicInstalling the packages

Stepic

#tar xzf stepic-0.3.tar.gz

#cd stepic-0.3

#python setup.py install

Steganography with stepic

  1. Start the Python interative shell$python
  2. Import PIL’s Image and the stepic module
  3. >>>import Image, stepic
  4. Open the image file in which you want to hide data
  5. >>>im=image.open(“cyber.jpg”);
  6. Encode some text into the source image. This returnd another image instance, which you need to save to a new file:>>>im2=stepic.encode(im, ‘This is the hidden text’)>>>im2.save(‘cyber2.jpg’,'JPEG’)
  7. Display both the images(with and without hidden data) to see if there is any visible changes:>>>im2=Image.open(“cyber2.jpg”)>>>im2.show()>>>im.show()

    use the decode() function to extract data from an image:

      >>>im1.Image.open(‘cyber2.jpg’)

      >>>s=stepic.decode(im1)

      >>>data=s.decode()

      >>>print data

      This is hidden text

Download Stepic

Jun 4 / Cyb3r

Dear Friends

Dear friends this is your cyber. You can get awesome contents from here. wait and see…..

View in: Mobile | Standard