StegaPy插件基类
| 31 | |
| 32 | |
| 33 | class StegaPyPlugin: |
| 34 | """StegaPy插件基类""" |
| 35 | |
| 36 | def __init__(self, config: Optional[StegaPyConfig] = None): |
| 37 | """初始化插件""" |
| 38 | self.config = config or self.create_config() |
| 39 | |
| 40 | def get_name(self) -> str: |
| 41 | """获取插件名称""" |
| 42 | raise NotImplementedError |
| 43 | |
| 44 | def get_purposes(self) -> List[Purpose]: |
| 45 | """获取插件支持的用途""" |
| 46 | raise NotImplementedError |
| 47 | |
| 48 | def get_description(self) -> str: |
| 49 | """获取插件描述""" |
| 50 | raise NotImplementedError |
| 51 | |
| 52 | def embed_data(self, msg: bytes, msg_filename: Optional[str], |
| 53 | cover: bytes, cover_filename: Optional[str], |
| 54 | stego_filename: Optional[str]) -> bytes: |
| 55 | """嵌入数据到封面图像""" |
| 56 | raise NotImplementedError |
| 57 | |
| 58 | def extract_msg_filename(self, stego_data: bytes, |
| 59 | stego_filename: Optional[str]) -> str: |
| 60 | """从隐写数据中提取消息文件名""" |
| 61 | raise NotImplementedError |
| 62 | |
| 63 | def extract_data(self, stego_data: bytes, stego_filename: Optional[str], |
| 64 | orig_sig_data: Optional[bytes] = None) -> bytes: |
| 65 | """从隐写数据中提取消息""" |
| 66 | raise NotImplementedError |
| 67 | |
| 68 | def generate_signature(self) -> bytes: |
| 69 | """生成签名数据(用于水印)""" |
| 70 | raise NotImplementedError |
| 71 | |
| 72 | def check_mark(self, stego_data: bytes, stego_filename: Optional[str], |
| 73 | orig_sig_data: bytes) -> float: |
| 74 | """检查水印相关性""" |
| 75 | watermark_data = self.extract_data(stego_data, stego_filename, orig_sig_data) |
| 76 | return self.get_watermark_correlation(orig_sig_data, watermark_data) |
| 77 | |
| 78 | def get_watermark_correlation(self, orig_sig_data: bytes, |
| 79 | watermark_data: bytes) -> float: |
| 80 | """获取水印相关性""" |
| 81 | raise NotImplementedError |
| 82 | |
| 83 | def get_high_watermark_level(self) -> float: |
| 84 | """获取高水印阈值""" |
| 85 | raise NotImplementedError |
| 86 | |
| 87 | def get_low_watermark_level(self) -> float: |
| 88 | """获取低水印阈值""" |
| 89 | raise NotImplementedError |
| 90 |
nothing calls this directly
no outgoing calls
no test coverage detected