mirror of
https://github.com/cedricbonhomme/Stegano.git
synced 2025-06-28 19:26:14 +02:00
Check if the generator is implemented in Stegano.
This commit is contained in:
parent
d850bbd8a0
commit
a0f6f24d7c
3 changed files with 13 additions and 5 deletions
|
@ -66,9 +66,13 @@ def hide(input_image_file, message, generator_function, auto_convert_rgb=False):
|
|||
npixels = width * height
|
||||
len_message_bits = len(message_bits)
|
||||
if len_message_bits > npixels * 3:
|
||||
raise Exception("""The message you want to hide is too long (%s > %s).""" % (len_message_bits, npixels * 3))
|
||||
raise Exception("The message you want to hide is too long: {}".\
|
||||
format(message_length))
|
||||
|
||||
generator = getattr(generators, generator_function)()
|
||||
try:
|
||||
generator = getattr(generators, generator_function)()
|
||||
except AttributeError as e:
|
||||
raise e
|
||||
|
||||
while index + 3 <= len_message_bits :
|
||||
generated_number = next(generator)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue