Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Perform XOR over symbollic expression

I have written the code for a function but rather than addition I want to perform XOR how can I do it.

current output of

a,b = LR('a','b',3)

LRinv(a,b,3) is

(a + P1(b + P2(a + P1(b) + 2P3(b + P2(a + P1(b)))) + P2(a + P1(b))) + P1(b) + 2P3(b + P2(a + P1(b))), b + P2(a + P1(b) + 2*P3(b + P2(a + P1(b)))) + P2(a + P1(b)))

Rather it should be (a,b) if XORED.

Thanks is advance!!! def LR(L,R,rounds): if(type(L)==type(R)==type('a')): R = var(R) L = var(L) for r in range(0,rounds): perm = DeprecatedSFunction("P"+str(r+1),1) temp = R R = L.__xor__(perm(R)) L = temp return(L,R)

def LRinv(L,R,rounds): if(type(L)==type(R)==type('a')): R = var(L) L = var(R) else: temp = R R = L L = temp for r in range(0,rounds): perm = DeprecatedSFunction("P"+str(rounds-r),1) temp = R R = L.__xor__(perm(R)) L = temp return(R,L)

Perform XOR over symbollic expression

I have written the code for a function but rather than addition I want to perform XOR how can I do it.

current output of

a,b = LR('a','b',3)

LRinv(a,b,3) LR('a','b',3) LRinv(a,b,3)

is

(a + P1(b + P2(a + P1(b) + 2P3(b 2*P3(b + P2(a + P1(b)))) + P2(a + P1(b))) + P1(b) + 2P3(b 2*P3(b + P2(a + P1(b))), b + P2(a + P1(b) + 2*P3(b + P2(a + P1(b)))) + P2(a + P1(b)))

P1(b)))

Rather it should be (a,b) if XORED.

Thanks is advance!!! advance!!!

def LR(L,R,rounds):
    if(type(L)==type(R)==type('a')):
        R = var(R)
        L = var(L)
    for r in range(0,rounds):
        perm = DeprecatedSFunction("P"+str(r+1),1)
        temp = R
        R = L.__xor__(perm(R))
        L = temp
    return(L,R)

return(L,R) def LRinv(L,R,rounds): if(type(L)==type(R)==type('a')): R = var(L) L = var(R) else: temp = R R = L L = temp for r in range(0,rounds): perm = DeprecatedSFunction("P"+str(rounds-r),1) temp = R R = L.__xor__(perm(R)) L = temp return(R,L)

return(R,L)
click to hide/show revision 3
retagged

Perform XOR over symbollic expression

I have written the code for a function but rather than addition I want to perform XOR how can I do it.

current output of

a,b = LR('a','b',3)

LRinv(a,b,3)

is

(a + P1(b + P2(a + P1(b) + 2*P3(b + P2(a + P1(b)))) + P2(a + P1(b))) + P1(b) + 2*P3(b + P2(a + P1(b))), b + P2(a + P1(b) + 2*P3(b + P2(a + P1(b)))) + P2(a + P1(b)))

Rather it should be (a,b) if XORED.

Thanks is advance!!!

def LR(L,R,rounds):
    if(type(L)==type(R)==type('a')):
        R = var(R)
        L = var(L)
    for r in range(0,rounds):
        perm = DeprecatedSFunction("P"+str(r+1),1)
        temp = R
        R = L.__xor__(perm(R))
        L = temp
    return(L,R)

def LRinv(L,R,rounds):
    if(type(L)==type(R)==type('a')):
        R = var(L)
        L = var(R)
    else:
        temp = R
        R = L
        L = temp
    for r in range(0,rounds):
        perm = DeprecatedSFunction("P"+str(rounds-r),1)
        temp = R
        R = L.__xor__(perm(R))
        L = temp
    return(R,L)