Comments (4)
By the way, for your original expression, you can use "lazy evaluation" using Arybo expressions. This is a less documented feature, I've got to put it in the final documentation.
Here is the example script:
from arybo.lib import MBA
from arybo.lib.mba_exprs import ExprBV, eval_expr
def transform(x):
return (((((((- (((((((((((((((- x) & 0xffffffff) + 0x2C) & 0xffffffff) & ((((((- x) & 0xffffffff) + 0x2C) & 0xffffffff) | 0xC4) & 0xffffffff)) & 0xffffffff) ^ ((x + 0xFFFFFFD4) & 0xffffffff)) & 0xffffffff) + 0x80403064) & 0xffffffff) ^ 0xED) & 0xffffffff) | 0x403053) & 0xffffffff) & 0xff)) & 0xff) + 0x7E) & 0xff) & 0xff) << 0) | ((0x0 & 0xffffff) << 8))
mba = MBA(32)
x = mba.var('x')
x = ExprBV(x)
f = transform(x)
print(f)
print(eval_expr(f))
This outputs:
Vec([
1,
1,
((x0 * x1) + x0 + x1),
((x0 * x2) + (x1 * x2) + (x0 * x1 * x2) + x2 + 1),
((x0 * x1) + x0 + x1),
((x2 * x3) + (x0 * x2 * x3) + (x1 * x2 * x3) + (x2 * x3 * x4) + (x0 * x1 * x2 * x3) + (x0 * x2 * x3 * x4) + (x1 * x2 * x3 * x4) + (x0 * x1 * x2 * x3 * x4)),
0,
((x2 * x3 * x5 * x6) + (x0 * x2 * x3 * x5 * x6) + (x1 * x2 * x3 * x5 * x6) + (x2 * x3 * x4 * x5 * x6) + (x0 * x1 * x2 * x3 * x5 * x6) + (x0 * x2 * x3 * x4 * x5 * x6) + (x1 * x2 * x3 * x4 * x5 * x6) + (x0 * x1 * x2 * x3 * x4 * x5 * x6) + 1),
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
])
from arybo.
I have reduced the testcase to this small expression:
from arybo.lib import MBA
def transform(x):
a = 1 - x
b = x + 1
c = a ^ b
return c
mba = MBA(32)
x = mba.var('x')
print (transform(x))
from arybo.
Hello!
If you try it on 16 bits this will work in a decent amount of time. I think the expression start to be become too big above 16 bits to handle.
By the way, I am working on a new tree-based storage for boolean expression, that can consume more memory but be really more efficient in some cases!
from arybo.
Thank you :) I guess that will do it for now.
from arybo.
Related Issues (17)
- Pytanque installation fails on Ubuntu 14.04 HOT 11
- AttributeError: 'ExprConcat' object has no attribute 'urem' HOT 1
- Arybo does not support Python 2.7 in Windows HOT 3
- llvmlite should be added as a dependency HOT 1
- std::bad_alloc thrown in symbolic expression computation HOT 1
- tritonast2arybo: unsupported node type 79 (BVSMOD) HOT 1
- CMake Script is incorrect?
- petanque tests fail to find TBB HOT 1
- Examples using outdated Triton API
- error: invalid use of incomplete type 'PyFrameObject' {aka 'struct _frame'} HOT 2
- NumPy has deprecated int type HOT 1
- Installation Arybo via pip on Windows, 'ssize_t': redefinition HOT 2
- arybo latest on pip broken HOT 1
- Support new design of Triton in Python examples HOT 1
- app_inverse for expressions with more than one symbols HOT 1
- 'AstNode' object has no attribute 'getKind' HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arybo.