mirror of
https://github.com/cedricbonhomme/Stegano.git
synced 2025-05-12 17:18:30 +02:00
Various improvements in lsb and lsbset modules.
This commit is contained in:
parent
119aecf3a6
commit
b9fad5f044
2 changed files with 5 additions and 14 deletions
|
@ -89,12 +89,9 @@ def hide(input_image_file, message, auto_convert_rgb=False):
|
||||||
img.close()
|
img.close()
|
||||||
return encoded
|
return encoded
|
||||||
|
|
||||||
img.close()
|
|
||||||
return encoded
|
|
||||||
|
|
||||||
def reveal(input_image_file):
|
def reveal(input_image_file):
|
||||||
"""Find a message in an image
|
"""Find a message in an image (with the LSB technique).
|
||||||
(with the LSB technique).
|
|
||||||
"""
|
"""
|
||||||
img = Image.open(input_image_file)
|
img = Image.open(input_image_file)
|
||||||
width, height = img.size
|
width, height = img.size
|
||||||
|
@ -123,5 +120,3 @@ def reveal(input_image_file):
|
||||||
if len(bitab)-len(str(limit))-1 == limit :
|
if len(bitab)-len(str(limit))-1 == limit :
|
||||||
img.close()
|
img.close()
|
||||||
return "".join(bitab)[len(str(limit))+1:]
|
return "".join(bitab)[len(str(limit))+1:]
|
||||||
img.close()
|
|
||||||
return ""
|
|
||||||
|
|
|
@ -54,8 +54,7 @@ def hide(input_image_file, message, generator, auto_convert_rgb=False):
|
||||||
width, height = img.size
|
width, height = img.size
|
||||||
index = 0
|
index = 0
|
||||||
|
|
||||||
message = str(len(message)) + ":" + str(message)
|
message = str(message_length) + ":" + str(message)
|
||||||
#message_bits = tools.a2bits(message)
|
|
||||||
message_bits = "".join(tools.a2bits_list(message))
|
message_bits = "".join(tools.a2bits_list(message))
|
||||||
message_bits += '0' * ((3 - (len(message_bits) % 3)) % 3)
|
message_bits += '0' * ((3 - (len(message_bits) % 3)) % 3)
|
||||||
|
|
||||||
|
@ -92,8 +91,7 @@ def hide(input_image_file, message, generator, auto_convert_rgb=False):
|
||||||
|
|
||||||
|
|
||||||
def reveal(input_image_file, generator):
|
def reveal(input_image_file, generator):
|
||||||
"""Find a message in an image
|
"""Find a message in an image (with the LSB technique).
|
||||||
(with the LSB technique).
|
|
||||||
"""
|
"""
|
||||||
img = Image.open(input_image_file)
|
img = Image.open(input_image_file)
|
||||||
img_list = list(img.getdata())
|
img_list = list(img.getdata())
|
||||||
|
@ -118,5 +116,3 @@ def reveal(input_image_file, generator):
|
||||||
pass
|
pass
|
||||||
if len(bitab)-len(str(limit))-1 == limit :
|
if len(bitab)-len(str(limit))-1 == limit :
|
||||||
return "".join(bitab)[len(str(limit))+1:]
|
return "".join(bitab)[len(str(limit))+1:]
|
||||||
|
|
||||||
return ""
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue