Expand description
§Boo
Boo encrypts literal data in the final binary, at compile time, preventing static analysis tools from reading values.
§Usage
Add the dependency:
[dependencies]
boo-rs = "0.1"Set an optional encryption key (or fallback to a 64-byte randomly generated one):
export BOO_KEY="secret-key"§Example
extern crate alloc;
#[macro_use]
extern crate boo_rs;
boo_init!();
#[allow(unused_variables)]
fn main() {
let n = boo!(3);
let text = boo!("hello");
let bytes = boo!(b"\x01\x02\x03");
let pair = boo!(("host", 443));
let nested = boo!([[1, 2], [3, 4]]);
}boo_init!() must be called once before using the boo!() macro.
After that, the macro can be used anywhere to encrypt almost all Rust literal values.
§Performance
Decryption happens on the stack. The cost is O(n), where n is the length of the data in bytes.
- All decrypted types except
StringandCStrare stored on the stack without performance overhead. &strand&CStrdecryption are stored into their heap-allocated variants.- Special case: binary strings are decrypted into owned
[u8]arrays.
Macros§
- boo
- Encrypts a literal
- boo_
include_ bytes - Encrypts a raw file as bytes
- boo_
include_ env - Encrypts raw file from the path specified by an environment variable
- boo_
include_ str - Encrypts a UTF-8 file as a string
- boo_
init - Initialize the boo library allowing use of the boo macros.