mirror of
https://github.com/zs-yg/kortapp-z.git
synced 2025-12-06 16:10:42 +08:00
废弃的零宽字符隐藏器
欸
This commit is contained in:
19
others/C++/stegano_project/include/CommonDefs.hpp
Normal file
19
others/C++/stegano_project/include/CommonDefs.hpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef COMMON_DEFS_HPP
|
||||
#define COMMON_DEFS_HPP
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
|
||||
namespace CommonDefs {
|
||||
// 零宽字符定义
|
||||
constexpr wchar_t ZERO_WIDTH_SPACE = 0x200B; // 用于表示二进制0
|
||||
constexpr wchar_t ZERO_WIDTH_NON_JOINER = 0x200C; // 用于表示二进制1
|
||||
constexpr wchar_t ZERO_WIDTH_JOINER = 0x200D; // 用于分隔符
|
||||
|
||||
// 转换函数声明
|
||||
std::wstring utf8_to_wstring(const std::string& str);
|
||||
std::string wstring_to_utf8(const std::wstring& wstr);
|
||||
}
|
||||
|
||||
#endif // COMMON_DEFS_HPP
|
||||
36
others/C++/stegano_project/include/GUI.hpp
Normal file
36
others/C++/stegano_project/include/GUI.hpp
Normal file
@@ -0,0 +1,36 @@
|
||||
// include/GUI.hpp (添加类前向声明)
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/Fl_Window.H>
|
||||
#include <FL/Fl_Tabs.H>
|
||||
#include <FL/Fl_Group.H>
|
||||
#include <FL/Fl_Button.H>
|
||||
#include <FL/Fl_Input.H>
|
||||
#include <FL/Fl_Multiline_Input.H>
|
||||
#include <FL/Fl_Multiline_Output.H>
|
||||
#include <FL/Fl_Box.H>
|
||||
#include "Steganography.hpp"
|
||||
|
||||
class MainWindow : public Fl_Window {
|
||||
public:
|
||||
MainWindow(int width, int height, const char* title);
|
||||
|
||||
private:
|
||||
Fl_Tabs* tabs;
|
||||
Fl_Group* embedGroup;
|
||||
Fl_Group* extractGroup;
|
||||
|
||||
// Embed widgets
|
||||
Fl_Multiline_Input* coverInput;
|
||||
Fl_Multiline_Input* messageInput;
|
||||
Fl_Button* encodeBtn;
|
||||
Fl_Multiline_Output* resultOutput;
|
||||
|
||||
// Extract widgets
|
||||
Fl_Multiline_Input* extractInput;
|
||||
Fl_Button* decodeBtn;
|
||||
Fl_Multiline_Output* extractedOutput;
|
||||
|
||||
// Callbacks
|
||||
static void encode_cb(Fl_Widget* w, void* data);
|
||||
static void decode_cb(Fl_Widget* w, void* data);
|
||||
};
|
||||
16
others/C++/stegano_project/include/Steganography.hpp
Normal file
16
others/C++/stegano_project/include/Steganography.hpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef STEGANOGRAPHY_HPP
|
||||
#define STEGANOGRAPHY_HPP
|
||||
|
||||
#include "ZeroWidthEncoder.hpp"
|
||||
#include <string>
|
||||
|
||||
class Steganography {
|
||||
public:
|
||||
static std::wstring embed(const std::wstring& cover_text, const std::string& message);
|
||||
static std::string extract(const std::wstring& stego_text);
|
||||
|
||||
private:
|
||||
static bool is_zero_width(wchar_t c);
|
||||
};
|
||||
|
||||
#endif // STEGANOGRAPHY_HPP
|
||||
17
others/C++/stegano_project/include/ZeroWidthEncoder.hpp
Normal file
17
others/C++/stegano_project/include/ZeroWidthEncoder.hpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef ZERO_WIDTH_ENCODER_HPP
|
||||
#define ZERO_WIDTH_ENCODER_HPP
|
||||
|
||||
#include "CommonDefs.hpp"
|
||||
#include <string>
|
||||
|
||||
class ZeroWidthEncoder {
|
||||
public:
|
||||
static std::wstring encode(const std::string& message);
|
||||
static std::string decode(const std::wstring& encoded);
|
||||
|
||||
private:
|
||||
static std::wstring char_to_zero_width(char c);
|
||||
static char zero_width_to_char(const std::wstring& sequence);
|
||||
};
|
||||
|
||||
#endif // ZERO_WIDTH_ENCODER_HPP
|
||||
Reference in New Issue
Block a user