mirror of
https://github.com/cedricbonhomme/Stegano.git
synced 2025-06-28 03:06:14 +02:00
Support hide/reveal for image byte objects
This commit is contained in:
parent
5b362403db
commit
486358de69
2 changed files with 31 additions and 4 deletions
|
@ -26,6 +26,7 @@ __license__ = "GPLv3"
|
|||
|
||||
import os
|
||||
import unittest
|
||||
import io
|
||||
|
||||
from stegano import exifHeader
|
||||
|
||||
|
@ -82,6 +83,16 @@ class TestEXIFHeader(unittest.TestCase):
|
|||
with self.assertRaises(ValueError):
|
||||
clear_message = exifHeader.reveal("./image.png")
|
||||
|
||||
def test_with_bytes(self):
|
||||
outputBytes = io.BytesIO()
|
||||
message = b"Secret"
|
||||
exifHeader.hide("./tests/sample-files/20160505T130442.jpg",
|
||||
outputBytes,
|
||||
secret_message=message)
|
||||
|
||||
clean_message = exifHeader.reveal(outputBytes)
|
||||
self.assertEqual(message, clean_message)
|
||||
|
||||
def tearDown(self):
|
||||
try:
|
||||
os.unlink("./image.jpg")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue