Skip to content

lijing-2008/pngme

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

这是我的第一个Rust小项目,将一串字符串信息隐藏进png图片,原理是新增一个对图片显示没有影响的chunk,解析该chunk就可以得到隐藏的信息。 参考链接:https://picklenerd.github.io/pngme_book/introduction.html

Introduction

该小项目根据PNG文件结构自定义Png的创建与解析,PNG文件结构其实很简单,由一个固定头signature和多个chunk组合而成,如下图所示 png_struct.png 具体细节还有很多,包括chunk_type的定义,chunk_type由各自字母组成,大小写的不同代表了chunk的不同特性。 将

Data Structure

ChunkType

pub struct ChunkType(u8, u8, u8, u8);

Chunk

pub struct Chunk {
    data_length: u32,
    chunk_type: ChunkType,
    data: Vec<u8>,
    crc: u32,
}

Png

pub struct Png {
    signature: [u8; 8],
    pub(crate) chunks: Vec<Chunk>,
}

使用示例

pngme encode <file_path> <chunk_type> <out_file_path> pngme decode <file_path> <chunk_type> pngme remove <file_path> <chunk_type> pngme print <file_path> image.png

About

hide secret message into png

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages