6 stable releases
1.2.3 | Nov 19, 2024 |
---|---|
1.2.1 | Nov 17, 2024 |
1.1.0 | Nov 14, 2024 |
1.0.0 | Nov 12, 2024 |
#1493 in Encoding
534 downloads per month
23KB
253 lines
ASBS
The ASBS (Arbitrarily Significant Bits) library provides the traits and implementations useful for steganographic concealment and extraction of messages.
Binary Implementation
The library provides the binary
module which can be used to encode messages in binary
data with bit patterns, which act as keys and should be shared with the receiver of
the message.
Bit patterns are defined as a function that takes a byte index and returns a bit mask for the byte at that index. They can be used to significantly increase the entropy level and thus hide the messages more effectively, as there's no one predetermined pattern that is used for all messages.
See src/binary.rs
for more details.
Examples
Hiding a message within a binary file:
use asbs::{binary, Conceal};
use std::fs::File;
// Define the bit pattern
let pattern = |i| Some(1u8 << (i % 3));
// Define the payload
let payload = b"a very secret message";
// Create a carrier with the given payload length, pattern, and output file
let mut carrier = binary::Carrier::with_embedded_len(
payload.len(),
pattern,
File::create("package")?,
);
// Write the payload hidden within the given cover file
carrier.conceal(
payload.as_slice(),
File::open("cover")?,
)?;
Extracting a hidden message from a binary file:
use asbs::{binary, Reveal};
use std::fs::File;
// Define the bit pattern
let pattern = |i| Some(1u8 << (i % 3));
// Create a package with the given pattern and input file
let mut package = binary::Package::with_embedded_len(
pattern,
File::open("package")?,
);
// Write the extracted message into a file
package.reveal(File::create("message")?)?;
License
The library is licensed under either the MIT License or the Apache-2.0 License, at your option.
Authors
Artemy Astakhov (contact at aeverless dot dev)