-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsteganography_interface.py
More file actions
61 lines (51 loc) · 1.83 KB
/
steganography_interface.py
File metadata and controls
61 lines (51 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from abc import ABC, abstractmethod
from PIL import Image
from typing import Tuple, Any, Dict, Optional
class SteganographyMethod(ABC):
"""
Abstract base class for steganography methods.
"""
@abstractmethod
def get_name(self) -> str:
"""Returns the name of the steganography method."""
pass
@abstractmethod
def embed(
self,
image: Image.Image,
payload: bytes,
settings: Optional[Dict[str, Any]] = None,
) -> Tuple[Optional[Image.Image], Any]:
"""
Embeds the payload into the image.
Args:
image (Image.Image): The cover image (PIL Image).
payload (bytes): The data to embed.
settings (Optional[Dict[str, Any]]): Method-specific settings.
Returns:
Tuple[Optional[Image.Image], Any]: A tuple containing:
- The stego image (PIL Image) or None on failure.
- Status message or metadata from the embedding process.
"""
pass
@abstractmethod
def extract(
self, image: Image.Image, settings: Optional[Dict[str, Any]] = None
) -> Tuple[Optional[bytes], Any]:
"""
Extracts the payload from the stego image.
Args:
image (Image.Image): The stego image (PIL Image).
settings (Optional[Dict[str, Any]]): Method-specific settings.
Returns:
Tuple[Optional[bytes], Any]: A tuple containing:
- The extracted payload (bytes) or None on failure/data not found.
- Status message or metadata from the extraction process.
"""
pass
def get_default_settings(self) -> Dict[str, Any]:
"""
Returns default settings for the method, if any.
These can be overridden during embed/extract calls.
"""
return {}