mirror of
https://github.com/cedricbonhomme/Stegano.git
synced 2025-06-28 03:06:14 +02:00
Updated CHANGELOG.
This commit is contained in:
parent
e490e32791
commit
0537c13a08
20 changed files with 89 additions and 92 deletions
|
@ -1,8 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Stegano - Stegano is a pure Python steganography module.
|
||||
# Copyright (C) 2010-2022 Cédric Bonhomme - https://www.cedricbonhomme.org
|
||||
# Copyright (C) 2010-2023 Cédric Bonhomme - https://www.cedricbonhomme.org
|
||||
#
|
||||
# For more information : https://git.sr.ht/~cedric/stegano
|
||||
#
|
||||
|
@ -25,9 +23,9 @@ __date__ = "$Date: 2016/05/17 $"
|
|||
__revision__ = "$Date: 2017/01/18 $"
|
||||
__license__ = "GPLv3"
|
||||
|
||||
import io
|
||||
import os
|
||||
import unittest
|
||||
import io
|
||||
|
||||
from stegano import exifHeader
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Stegano - Stegano is a pure Python steganography module.
|
||||
# Copyright (C) 2010-2022 Cédric Bonhomme - https://www.cedricbonhomme.org
|
||||
# Copyright (C) 2010-2023 Cédric Bonhomme - https://www.cedricbonhomme.org
|
||||
#
|
||||
# For more information : https://git.sr.ht/~cedric/stegano
|
||||
#
|
||||
|
@ -25,8 +23,9 @@ __date__ = "$Date: 2017/03/01 $"
|
|||
__revision__ = "$Date: 2017/03/01 $"
|
||||
__license__ = "GPLv3"
|
||||
|
||||
import unittest
|
||||
import itertools
|
||||
import unittest
|
||||
|
||||
import cv2
|
||||
import numpy as np
|
||||
|
||||
|
@ -71,7 +70,7 @@ class TestGenerators(unittest.TestCase):
|
|||
|
||||
def test_eratosthenes(self):
|
||||
"""Test the Eratosthenes sieve."""
|
||||
with open("./tests/expected-results/eratosthenes", "r") as f:
|
||||
with open("./tests/expected-results/eratosthenes") as f:
|
||||
self.assertEqual(
|
||||
tuple(itertools.islice(generators.eratosthenes(), 168)),
|
||||
tuple(int(line) for line in f),
|
||||
|
@ -79,7 +78,7 @@ class TestGenerators(unittest.TestCase):
|
|||
|
||||
def test_composite(self):
|
||||
"""Test the composite sieve."""
|
||||
with open("./tests/expected-results/composite", "r") as f:
|
||||
with open("./tests/expected-results/composite") as f:
|
||||
self.assertEqual(
|
||||
tuple(itertools.islice(generators.composite(), 114)),
|
||||
tuple(int(line) for line in f),
|
||||
|
@ -87,7 +86,7 @@ class TestGenerators(unittest.TestCase):
|
|||
|
||||
def test_fermat(self):
|
||||
"""Test the Fermat generator."""
|
||||
with open("./tests/expected-results/fermat", "r") as f:
|
||||
with open("./tests/expected-results/fermat") as f:
|
||||
self.assertEqual(
|
||||
tuple(itertools.islice(generators.fermat(), 9)),
|
||||
tuple(int(line) for line in f),
|
||||
|
@ -95,7 +94,7 @@ class TestGenerators(unittest.TestCase):
|
|||
|
||||
def test_triangular_numbers(self):
|
||||
"""Test the Triangular numbers generator."""
|
||||
with open("./tests/expected-results/triangular_numbers", "r") as f:
|
||||
with open("./tests/expected-results/triangular_numbers") as f:
|
||||
self.assertEqual(
|
||||
tuple(itertools.islice(generators.triangular_numbers(), 54)),
|
||||
tuple(int(line) for line in f),
|
||||
|
@ -103,7 +102,7 @@ class TestGenerators(unittest.TestCase):
|
|||
|
||||
def test_mersenne(self):
|
||||
"""Test the Mersenne generator."""
|
||||
with open("./tests/expected-results/mersenne", "r") as f:
|
||||
with open("./tests/expected-results/mersenne") as f:
|
||||
self.assertEqual(
|
||||
tuple(itertools.islice(generators.mersenne(), 20)),
|
||||
tuple(int(line) for line in f),
|
||||
|
@ -111,7 +110,7 @@ class TestGenerators(unittest.TestCase):
|
|||
|
||||
def test_carmichael(self):
|
||||
"""Test the Carmichael generator."""
|
||||
with open("./tests/expected-results/carmichael", "r") as f:
|
||||
with open("./tests/expected-results/carmichael") as f:
|
||||
self.assertEqual(
|
||||
tuple(itertools.islice(generators.carmichael(), 33)),
|
||||
tuple(int(line) for line in f),
|
||||
|
@ -119,7 +118,7 @@ class TestGenerators(unittest.TestCase):
|
|||
|
||||
def test_ackermann_slow(self):
|
||||
"""Test the Ackermann set."""
|
||||
with open("./tests/expected-results/ackermann", "r") as f:
|
||||
with open("./tests/expected-results/ackermann") as f:
|
||||
self.assertEqual(generators.ackermann_slow(3, 1), int(f.readline()))
|
||||
self.assertEqual(generators.ackermann_slow(3, 2), int(f.readline()))
|
||||
|
||||
|
@ -127,13 +126,13 @@ class TestGenerators(unittest.TestCase):
|
|||
"""Test the Naive Ackermann generator"""
|
||||
gen = generators.ackermann_naive(3)
|
||||
next(gen)
|
||||
with open("./tests/expected-results/ackermann", "r") as f:
|
||||
with open("./tests/expected-results/ackermann") as f:
|
||||
self.assertEqual(next(gen), int(f.readline()))
|
||||
self.assertEqual(next(gen), int(f.readline()))
|
||||
|
||||
def test_ackermann_fast(self):
|
||||
"""Test the Ackermann set."""
|
||||
with open("./tests/expected-results/ackermann", "r") as f:
|
||||
with open("./tests/expected-results/ackermann") as f:
|
||||
self.assertEqual(generators.ackermann_fast(3, 1), int(f.readline()))
|
||||
self.assertEqual(generators.ackermann_fast(3, 2), int(f.readline()))
|
||||
self.assertEqual(generators.ackermann_fast(4, 1), int(f.readline()))
|
||||
|
@ -142,13 +141,13 @@ class TestGenerators(unittest.TestCase):
|
|||
"""Test the Ackermann generator"""
|
||||
gen = generators.ackermann(3)
|
||||
next(gen)
|
||||
with open("./tests/expected-results/ackermann", "r") as f:
|
||||
with open("./tests/expected-results/ackermann") as f:
|
||||
self.assertEqual(next(gen), int(f.readline()))
|
||||
self.assertEqual(next(gen), int(f.readline()))
|
||||
|
||||
def test_LFSR(self):
|
||||
"""Test the LFSR generator"""
|
||||
with open("./tests/expected-results/LFSR", "r") as f:
|
||||
with open("./tests/expected-results/LFSR") as f:
|
||||
self.assertEqual(
|
||||
tuple(itertools.islice(generators.LFSR(2**8), 256)),
|
||||
tuple(int(line) for line in f),
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Stegano - Stegano is a pure Python steganography module.
|
||||
# Copyright (C) 2010-2022 Cédric Bonhomme - https://www.cedricbonhomme.org
|
||||
# Copyright (C) 2010-2023 Cédric Bonhomme - https://www.cedricbonhomme.org
|
||||
#
|
||||
# For more information : https://git.sr.ht/~cedric/stegano
|
||||
#
|
||||
|
@ -173,7 +171,12 @@ class TestLSB(unittest.TestCase):
|
|||
@patch("builtins.input", return_value="n")
|
||||
def test_refuse_convert_rgb(self, input):
|
||||
message_to_hide = "Hello World!"
|
||||
with self.assertRaises(Exception):
|
||||
# lsb.hide(
|
||||
# "./tests/sample-files/Lenna-grayscale.png",
|
||||
# message_to_hide,
|
||||
# generators.eratosthenes(),
|
||||
# )
|
||||
with self.assertRaisesRegex(Exception, "Not a RGB image."):
|
||||
lsb.hide(
|
||||
"./tests/sample-files/Lenna-grayscale.png",
|
||||
message_to_hide,
|
||||
|
@ -210,7 +213,9 @@ class TestLSB(unittest.TestCase):
|
|||
with open("./tests/sample-files/lorem_ipsum.txt") as f:
|
||||
message = f.read()
|
||||
message += message * 2
|
||||
with self.assertRaises(Exception):
|
||||
with self.assertRaisesRegex(
|
||||
Exception, "The message you want to hide is too long:"
|
||||
):
|
||||
lsb.hide("./tests/sample-files/Lenna.png", message, generators.identity())
|
||||
|
||||
def test_hide_and_reveal_with_bad_generator(self):
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Stegano - Stegano is a pure Python steganography module.
|
||||
# Copyright (C) 2010-2022 Cédric Bonhomme - https://www.cedricbonhomme.org
|
||||
# Copyright (C) 2010-2023 Cédric Bonhomme - https://www.cedricbonhomme.org
|
||||
#
|
||||
# For more information : https://git.sr.ht/~cedric/stegano
|
||||
#
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Stegano - Stegano is a pure Python steganography module.
|
||||
# Copyright (C) 2010-2022 Cédric Bonhomme - https://www.cedricbonhomme.org
|
||||
# Copyright (C) 2010-2023 Cédric Bonhomme - https://www.cedricbonhomme.org
|
||||
#
|
||||
# For more information : https://git.sr.ht/~cedric/stegano
|
||||
#
|
||||
|
@ -83,7 +81,7 @@ class TestTools(unittest.TestCase):
|
|||
self.assertEqual(list(result), [(1, 2), (3, 4), (5, "X")])
|
||||
|
||||
def test_binary2base64(self):
|
||||
with open("./tests/expected-results/binary2base64", "r") as f:
|
||||
with open("./tests/expected-results/binary2base64") as f:
|
||||
expected_value = f.read()
|
||||
value = tools.binary2base64("tests/sample-files/free-software-song.ogg")
|
||||
self.assertEqual(expected_value, value)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue