pngchat/lib.rs
1//! Hide messages in the PNG file.
2//!
3//! The intent of this little project is to learn how to encode PNG file and add some messages inside it
4//!
5//! Idea come from [PNGme: An Intermediate Rust Project](https://picklenerd.github.io/pngme_book/introduction.html)
6//!
7//! # Goal
8//! Making a command line program that lets you hide secret messages in PNG files.
9//!
10//! The main tasks of `pngchat` are:
11//! * Encode a message into a PNG file
12//! * Decode a message stored in a PNG file
13//! * Remove a message from a PNG file
14//! * Print a list of PNG chunks that can be searched for messages
15//!
16//! # Uasge
17//!
18//! ```bash
19//! # Encodes a message into a PNG file and saves the result
20//! pngchat encode ./test.png ruSt "This is a hidden message"
21//!
22//! # Searches for a message hidden in a PNG file and prints the message if one is found
23//! pngchat decode ./test.png ruSt
24//!
25//! # Removes a chunk from a PNG file and saves the result
26//! pngchat remove ./test.png ruSt
27//!
28//! # Prints all of the chunks in a PNG file
29//! pngchat print ./test.png
30//! ```
31//!
32//!
33//! # Links
34//! See the [PNG file structure spec](http://www.libpng.org/pub/png/spec/1.2/PNG-Structure.html) for more details about how PNG file structured
35
36pub mod args;
37pub mod commands;
38
39mod chunk;
40mod chunk_type;
41mod png;
42
43mod error;
44mod utils;
45
46pub use error::{Error, Result};
47pub use png::Png;
48
49pub use utils::{checksum_32, u8_4_from_slice};
50
51/// 4 bytes size
52pub const CHUNK_SIZE: usize = 4;