Text Blind Watermark in Python
Project description
text_blind_watermark
Put message(blind watermark) into a text. so that the message is invisible, and the changes of the text are not perceptible.
- Video demo:https://www.bilibili.com/video/BV1m3411s7kT
- Online demo(from old version, for demo only): https://www.guofei.site/pictures_for_blog/app/text_watermark/v1.html
- 中文 readme README_cn.md
- Source code: https://github.com/guofei9987/text_blind_watermark
- Rust Version: https://github.com/guofei9987/text-blind-watermark
Can be used in
- dingding
- zhihu.com
- ...
How to Use
install
>pip install text_blind_watermark
embed message into text:
from text_blind_watermark import TextBlindWatermark2
password = '20190808'
text = '这句话中有盲水印,你能提取出来吗?'
watermark = 'github.com/guofei9987'
text_blind_wm = TextBlindWatermark2(password=password)
text_with_wm = text_blind_wm.embed(text=text, watermark=watermark)
print(text_with_wm)
extract message from text
text_blind_wm2 = TextBlindWatermark2(password=password)
wm_extract = text_blind_wm2.extract(text_with_wm)
print('提取内容:', wm_extract)
github.com/guofei9987
chr_type
You can choose different type to get better performance.
from text_blind_watermark import TextBlindWatermark2
password = '20190808'
text = '这句话中有盲水印,你能提取出来吗?'
watermark = 'github.com/guofei9987'
text_blind_wm = TextBlindWatermark2(password=password, chr_type=(3, 4))
text_with_wm = text_blind_wm.embed(text=text, watermark=watermark)
print(text_with_wm)
text_blind_wm2 = TextBlindWatermark2(password=password, chr_type=(3, 4))
wm_extract = text_blind_wm2.extract(text_with_wm)
print('提取内容:', wm_extract)
assert watermark == wm_extract
Another algorithm is more robust
Alice Put her text watermark into a text:
from text_blind_watermark import TextBlindWatermark
watermark = "绝密:两点老地方见!"
text = "这句话中有盲水印,你能提取出来吗?" * 16
password = "20190808"
twm = TextBlindWatermark(password=password)
twm.read_wm(watermark=watermark)
twm.read_text(text=text)
text_embed = twm.embed()
print("打上盲水印之后:")
print(text_embed)
Then, you can paste this text to where you need.
Bob Extract the invisible watermark
from text_blind_watermark import TextBlindWatermark
password = "20190808"
twm_new = TextBlindWatermark(password=password)
wm_extract = twm_new.extract(text_embed)
print("解出的盲水印:")
print(wm_extract)
Related Project
HideInfo:https://github.com/guofei9987/HideInfo
算法 | 说明 |
---|---|
migrate tank | 使图片在不同的背景下显示不同的图片 |
hide as image | 把数据以图片形式存放 |
hide in image | 把数据藏在一个图片中 |
image seed | 把图片和文件黏在一起,并存为图片 |
EXIF | 把一段信息放到图片的EXIF中 |
hide as music | 把数据以音频的形式存放 |
hide in music | 把数据隐藏在一个音频中 |
hide as text | 把数据以文本文件的形式存放 |
hide in text | 把数据隐藏在一段文本中 |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for text_blind_watermark-0.3.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8967196976cbf8b83c7e815c61ee8368baad62dbdc63461f4f31a024728a739 |
|
MD5 | d9082bbe0c22a14191161e77f9fcd0ca |
|
BLAKE2b-256 | 2304dadea6a473f4e145cf0f25e351202575eb5eddc67e0e915e5b0ed257006b |
Close
Hashes for text_blind_watermark-0.3.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6132e897eb016fb2a259efbb17eb269c889ec62a3e606a2fe035b35843bea20 |
|
MD5 | 6a4b1b732f85f28075502d1582b10c59 |
|
BLAKE2b-256 | 5927a691a7e5711237686ba717724e5107943dee1a94070a97a8bde0f73f6270 |