Giter Club home page Giter Club logo

encrust's Introduction

Encrust

Crates.io Docs MIT licensed Build Status

A Rust crate for obfuscating data in memory by encrypting it, decrypting it only when needed. Encrust does not provide any security as the key and nonce required to decrypt the data is stored right next it. No integrity checks are performed either, which could lead to safety issues if the encrypted data is modified, for example resulting in Strings that are not valid UTF-8.

Example

Encrust comes with all features enabled by default, to use add the following to Cargo.toml:

[dependencies]
encrust = "0.1"

Encrust can then be used to obfuscate data, optionally at compile-time using the built-in macros.

use encrust::encrust;

// Encrust works by directly modifying the underlying memory
// Therefore, encrusted values must be mut in order to be read
let mut hidden_string = encrust!("This string will not appear as-is in the executable.");
// Numbers need to be suffixed wit their data type
let mut hidden_number = encrust!(0xabc123u32);

{
    // "Decrusted" implement Deref and DerefMut to the underlying data
    let string = hidden_string.decrust();
    let number = hidden_number.decrust();

    println!("The string is \"{}\" and the number 0x{:x}.", string.as_str(), *number);
}

// string and number are now out of scope and hidden_string and hidden_number are obfuscated again

Feature flags

Encrust has the following feature flags, all enabled by default:

  • std: Compile with std. Removing this causes the crate to be built as no_std.
  • macros: Include macros used for Derive macro and proc macros for obfuscating values at compile-time.
  • rand: Includes functions to obfuscate data at run-time using a rand::Rng, as well as a function to change the key and nonce used.

License

This project is licensed under the MIT license.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Encrust shall be licensed as MIT, without any additional terms or conditions.

encrust's People

Contributors

emiltayl avatar

Stargazers

Matthias avatar Christoph Grabo avatar  avatar Jax avatar tsingson avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.