521xueweihan / HelloGitHub

:octocat: 分享 GitHub 上有趣、入门级的开源项目。Share interesting, entry-level open source projects on GitHub.
https://hellogithub.com
92.59k stars 9.63k forks source link

【开源自荐】文本盲水印:把一段隐密信息嵌入到文本中 #2437

Closed guofei9987 closed 9 months ago

guofei9987 commented 1 year ago

推荐项目

如何嵌入水印:

from text_blind_watermark import TextBlindWatermarkThin

password = '20190808'
watermark = 'github.com/guofei9987'
text_blind_wm = TextBlindWatermarkThin(password=password)

wm = text_blind_wm.embed(watermark=watermark)
text_embed = '这句话中有盲' + wm + '水印,你能提取出来吗?'
print(text_embed)

如何提取水印

text_blind_wm_new = TextBlindWatermarkThin(password=password)
wm_extract = text_blind_wm_new.extract(text_embed)
print('提取内容:', wm_extract)

运行结果:

image

额外有个 html 版可供在线/离线使用

image

介绍视频:https://www.bilibili.com/video/BV1m3411s7kT/

521xueweihan commented 9 months ago

您推荐的项目,已成功发布HelloGitHub 第 94 期,并把您添加到了贡献者列表中。