Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/teovoinea/steganography
A simple steganography library written in rust
https://github.com/teovoinea/steganography
crates rust steganography steganography-library
Last synced: about 2 months ago
JSON representation
A simple steganography library written in rust
- Host: GitHub
- URL: https://github.com/teovoinea/steganography
- Owner: teovoinea
- License: mit
- Created: 2017-04-18T03:14:44.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-04-29T19:11:52.000Z (over 3 years ago)
- Last Synced: 2024-10-07T05:08:56.236Z (2 months ago)
- Topics: crates, rust, steganography, steganography-library
- Language: Rust
- Size: 2.2 MB
- Stars: 93
- Watchers: 7
- Forks: 13
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-rust-cn - teovoinea/steganography - ci.org/teovoinea/steganography.svg?branch=master">](https://travis-ci.org/teovoinea/steganography) (Libraries / Image processing)
- awesome-rust - teovoinea/steganography - ci.org/teovoinea/steganography.svg?branch=master">](https://travis-ci.org/teovoinea/steganography) (Libraries / Image processing)
- awesome-rust - teovoinea/steganography
- awesome-rust-cn - teovoinea/steganography
- awesome-rust-zh - teovoinea/steganography - 一个简单的隐写术(steganography)库[<img src="https://api.travis-ci.org/teovoinea/steganography.svg?branch=master">](https://travis-ci.org/teovoinea/steganography) (库 / 图像处理)
README
[![Build Status](https://dev.azure.com/voineateodor/voineateodor/_apis/build/status/teovoinea.steganography)](https://dev.azure.com/voineateodor/voineateodor/_build/latest?definitionId=1)
[![Build Status](https://travis-ci.org/teovoinea/steganography.svg?branch=master)](https://travis-ci.org/teovoinea/steganography)
[![Build status](https://ci.appveyor.com/api/projects/status/7u8v5jwu3w5ux23k/branch/master?svg=true)](https://ci.appveyor.com/project/teovoinea/steganography/branch/master)
[![Crates.io](https://img.shields.io/crates/v/steganography.svg)](https://crates.io/crates/steganography)
[![Crates.io](https://img.shields.io/crates/d/steganography.svg)](https://crates.io/crates/steganography)
[![Docs.rs](https://docs.rs/steganography/badge.svg)](https://docs.rs/steganography)
[![dependency status](https://deps.rs/repo/github/teovoinea/steganography/status.svg)](https://deps.rs/repo/github/teovoinea/steganography)# steganography
A stable steganography library written in rust[Crates.io](https://crates.io/crates/steganography)
## Usage
Add the following to the Cargo.toml in your project:
```toml
[dependencies]
steganography = "*"
```and import using ```extern crate```:
```rust
extern crate steganography;/*
use steganography::encoder::*;
use steganography::decoder::*;
use steganography::util::*;
*/
```## Writing a message to a file
```rust
//Define a secret message to hide in out picture
let message = "This is a steganography demo!".to_string();
//Convert our string to bytes
let payload = str_to_bytes(&message);
//Load the image where we want to embed our secret message
let destination_image = file_as_dynamic_image("example.jpg".to_string());
//Create an encoder
let enc = Encoder::new(payload, destination_image);
//Encode our message into the alpha channel of the image
let result = enc.encode_alpha();
//Save the new image
save_image_buffer(result, "hidden_message.png".to_string());
```## Reading a message from a file
```rust
//Load the image with the secret message
let encoded_image = file_as_image_buffer("examples/decode_message.png".to_string());
//Create a decoder
let dec = Decoder::new(encoded_image);
//Decode the image by reading the alpha channel
let out_buffer = dec.decode_alpha();
//If there is no alpha, it's set to 255 by default so we filter those out
let clean_buffer: Vec = out_buffer.into_iter()
.filter(|b| {
*b != 0xff_u8
})
.collect();
//Convert those bytes into a string we can read
let message = bytes_to_str(clean_buffer.as_slice());
//Print it out!
println!("{:?}", message);
```## Running the examples
```bash
cargo build --example example_encode
cargo run --example example_encode
``````bash
cargo build --example example_decode
cargo run --example example_decode
```## Testing
```bash
cargo test -- --test-threads=1
```