3 releases

0.1.8 Nov 20, 2024
0.1.7 Nov 19, 2024
0.1.6 Oct 31, 2024

#386 in Text processing

Download history 127/week @ 2024-10-28 13/week @ 2024-11-04 1/week @ 2024-11-11 306/week @ 2024-11-18 6/week @ 2024-11-25 15/week @ 2024-12-09

327 downloads per month

MIT license

12KB
84 lines

hidden_watermark

Crates.io Build Status Docs.rs License GitHub stars Forks Rust Crates.io Downloads GitHub Discussions

Hidden Watermark in Rust

  • Hidden Watermark in Text
  • Hidden Watermark in Image (png/jpg/...)

Put message(blind watermark) into a text. so that the message is invisible, and the changes of the text are not perceptible.

stars fork

How to Use

Cargo.toml

[dependencies]
hidden_watermark = "*"

Text Hidden Watermark

Can be used in

  • Wechat
  • dingding
  • zhihu.com
  • ...
use hidden_watermark::TextBlindWM;
use std::fs;
#[test]
fn example_text_hidden_watermark() {
    let pwd = "This is password".as_bytes();
    let wm = "This is a hidden message".as_bytes();
    let ori_filename = "./files/file.txt";
    let file_with_wm = "./files/outputs/file_with_wm.txt";


    let text_blind_watermark = TextBlindWM::new(pwd);

    let text = fs::read_to_string(ori_filename).unwrap();

    // embed
    let text_with_wm = text_blind_watermark.add_wm_rnd(text.as_str(), wm);
    // write into file
    fs::write(file_with_wm, text_with_wm).unwrap();
    println!("text with watermark saved in file <{}>", file_with_wm);

    // read text and extract the watermark
    let text_with_wm = fs::read_to_string(file_with_wm).unwrap();

    // extract
    let wm_extract = text_blind_watermark.extract(text_with_wm.as_str());

    println!("watermark extracted:{}", String::from_utf8_lossy(wm_extract.as_slice()))
}

It does not display well in IDE. Use other text editor or text viewer.

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 把数据隐藏在一段文本中

Python version: https://github.com/guofei9987/text_blind_watermark

Dependencies

~10KB