Created
March 24, 2019 19:28
-
-
Save DoMINAToR98/101e5c4933c5c10d42d16e25b3890821 to your computer and use it in GitHub Desktop.
Code for LSB-Steganography
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
import binascii | |
im = Image.open('pic.png') | |
pix_val = list(im.getdata()) | |
# print pix_val | |
lsbs="" | |
for idx,val in enumerate(pix_val): | |
# Converting each rgb values into binary and keeping only the Least Significant Bit | |
lsbs=lsbs+'{0:08b}'.format(val[0])[-1] | |
lsbs=lsbs+'{0:08b}'.format(val[1])[-1] | |
lsbs=lsbs+'{0:08b}'.format(val[2])[-1] | |
n=int(lsbs,2) | |
# Converting binary to ascii | |
print binascii.unhexlify('%x' % n) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment