From e2210bab547981ecd8825cd19a23634f2418a121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bonhomme?= Date: Sun, 10 Feb 2013 13:22:34 +0100 Subject: [PATCH] Raise an exception if the message to hide is too long. resolves #1 --- stegano/slsb.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stegano/slsb.py b/stegano/slsb.py index 4e4f841..5e06e9e 100755 --- a/stegano/slsb.py +++ b/stegano/slsb.py @@ -2,7 +2,7 @@ #-*- coding: utf-8 -*- # Stéganô - Stéganô is a basic Python Steganography module. -# Copyright (C) 2010-2013 Cédric Bonhomme - http://cedricbonhomme.org/ +# Copyright (C) 2010-2011 Cédric Bonhomme - http://cedricbonhomme.org/ # # For more information : http://bitbucket.org/cedricbonhomme/stegano/ # @@ -46,7 +46,7 @@ def hide(input_image_file, message): npixels = width * height if len(message_bits) > npixels * 3: - return """Too long message (%s > %s).""" % (len(message_bits), npixels * 3) + raise Exception("""The message you want to hide is too long (%s > %s).""" % (len(message_bits), npixels * 3)) for row in xrange(height): for col in xrange(width): @@ -160,4 +160,4 @@ if __name__ == '__main__': with open(options.secret_binary, "w") as f: f.write(data) else: - print secret + print secret \ No newline at end of file