python - Z3 - How to set a byte constraint on a BitVec -


i'm trying set list of possible allowed bytes in bitvec i'm not sure i'm setting constraints in right way.

e.g:

let have 32 bit bv called bv , solver() called s:

s = solver() bv = bitvec(8 * 4) 

i want each byte can either 0x2 or 0x34 or 0xff used extract():

i = 0 while (i < 8 * 4):     s.add(extract(i + 7, i, bv) == 0x2)     s.add(extract(i + 7, i, bv) == 0x34)     s.add(extract(i + 7, i, bv) == 0xff)      += 8 

sadly, s.check() returns unsat.

i think not correct way express bytes may 0x2 or 0x34 or 0xff. did write constraints in right way or thought process plain wrong?

i = 0 while (i < 8 * 4):    s.add(or(extract(i + 7, i, bv) == 0x2),              extract(i + 7, i, bv) == 0x34),             extract(i + 7, i, bv) == 0xff))  += 8 

Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -