#text #steganography #hiding #steg

whitespace_text_steganography

使用空格隐藏文本的隐写术策略

6个版本

使用旧的Rust 2015

0.2.1 2018年10月29日
0.2.0 2018年10月26日
0.1.3 2018年10月26日

#1032 in 文本处理


用于 steg

MIT 协议

10KB
117

whitespace_text_steganography

(零宽空格隐写术)

这个存储库是命令行工具 steg 的模块,但也可以独立使用。

它接受两个文本文件的路径,将第一个文件的内容隐藏在第二个文件中,然后可以再次揭示隐藏的文本。

用法

将以下内容添加到您项目的 Cargo.toml 中

[dependencies]
whitespace_text_steganography = "*"

payload.txtcarrier.txt 添加到名为 texts 的文件夹中。

并使用 extern crate 导入

extern crate whitespace_text_steganography;

use std::error::Error;
use std::fs::File;
use std::io::prelude::*;

use whitespace_text_steganography::{ hide, reveal };

fn main () {
    let payload_path = "./texts/payload.txt";
    let carrier_path = "./texts/carrier.txt";
    let output_path = "./hidden.txt";

    let text = hide(payload_path, carrier_path);
    println!("\n-------{}------", output_path);
    println!("{}", text);

    let mut file = match File::create(output_path) {
        Err(why) => panic!("couldn't create because: {}", why.description()),
        Ok(file) => file,
    };
    
    match file.write_all(text.as_bytes()) {
        Err(why) => panic!("couldn't write because: {}", why.description()),
        Ok(_) => (),
    }

    println!("\n--------The hidden message revealed---------");

    let hidden_message = reveal(output_path);
    println!("{}", hidden_message);
}

依赖项

~2–3MB
~53K SLoC