Giter VIP home page Giter VIP logo

mba's Introduction

Mixed Boolean-Arithmetic Obfuscation

This algorithm transforms expressions like x+y into monstrosities like this:

1771482302*(x & y) + -188000673*(x ^ y) + -1073741824*(~(x ^ (y ^ z))) + -1201767181*(~x) + -441272728*(~y) + -1327013878*y + -504443739*z + -569298085*(y & z) + -2087508331*(x | z) + -59975317*((~x) & z) + -1578185563*(y | (~z))

These kind of expressions involving both normal arithmetic as well as boolean operations are known as mixed boolean-arithmetic expressions. This particular transformation is only valid when x and y (and z) are 32-bit integers and the usual rules of computer arithmetic apply (e.g. when adding/multiplying numbers and there is an overflow then the most significant bits that can not be represented are cut off). In particular this will not work when the numbers are floating point numbers. Rust itself will panic (at least in debug builds) when addition/multiplication overflows so in order to use this with rust you will have to use the Wrapping types.

How it works

See my blog post about it.

Usage

If you want to try this for yourself, check out my implementation that compiles to WASM here, and is hosted as a web interface here.

References

[1] Information Hiding in Software with Mixed Boolean-Arithmetic Transforms

[2] Permutation Polynomials Modulo 2^w

[3] Binary Permutation Polynomial Inversion and Application to Obfuscation Techniques

[4] Soving AX = B using the Hermite normal form

mba's People

Contributors

plzin 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.