MCPcopy Create free account
hub / github.com/MearaY/StegaPy / main

Function main

app.py:40–122  ·  view source on GitHub ↗

主函数

()

Source from the content-addressed store, hash-verified

38
39
40def main():
41 """主函数"""
42 st.title("🔒 StegaPy - 隐写术工具")
43 st.markdown("---")
44
45 # 侧边栏
46 with st.sidebar:
47 st.header("功能选择")
48 mode = st.radio(
49 "选择功能模式",
50 ["数据隐藏", "数字水印"],
51 help="数据隐藏:将任意数据隐藏在图像中\n数字水印:在图像中嵌入不可见的水印签名"
52 )
53
54 st.markdown("---")
55 st.header("算法选择")
56
57 if mode == "数据隐藏":
58 plugin_name = st.selectbox(
59 "选择隐写算法",
60 ["LSB", "RandomLSB"],
61 help="LSB:最低有效位算法\nRandomLSB:随机LSB算法,提供更好的安全性"
62 )
63 else:
64 plugin_name = st.selectbox(
65 "选择水印算法",
66 ["DWTDugad"],
67 help="DWT Dugad:基于离散小波变换的水印算法"
68 )
69
70 st.markdown("---")
71 st.header("配置选项")
72
73 use_compression = st.checkbox("使用压缩", value=True,
74 help="使用GZIP压缩数据以减少嵌入数据大小")
75 use_encryption = st.checkbox("使用加密", value=False,
76 help="使用AES加密保护数据")
77
78 password = None
79 encryption_algorithm = "AES128"
80 if use_encryption:
81 password = st.text_input("密码", type="password",
82 help="用于加密/解密的密码")
83 encryption_algorithm = st.selectbox(
84 "加密算法",
85 ["AES128", "AES256"],
86 help="AES128:128位AES加密\nAES256:256位AES加密"
87 )
88
89 # LSB特定配置
90 if plugin_name in ["LSB", "RandomLSB"]:
91 st.markdown("---")
92 st.header("LSB参数")
93 max_bits = st.slider("每通道最大位数", 1, 8, 1,
94 help="每个颜色通道使用的最大位数")
95 else:
96 max_bits = 1
97

Callers 1

app.pyFile · 0.70

Calls 2

data_hiding_uiFunction · 0.85
watermarking_uiFunction · 0.85

Tested by

no test coverage detected