This is a fiestel cipher and I am trying to decode the stored message, however when I run it i get an exception unhandled "slice indices must be integers or None or have an index method". I traced it to (L,R) = G(test), but I am not sure what is wrong with what is being passed in
from base64 import b64decode
(a,b,c,d) = (12258487803861853193714140190369268261202205225846869845245886114503678185370576657001537611759067404857011052836681912514135296185688334428452462064527761,\
13346376869506979374836874046204370339910872071884888902215442517395171258258152757258082136597260296613932276350407476889729430724339742164666125768654387,\
10707278048073703090234519728300006549070759592219984101161107932419267899872157175740069946671710753166980969556028191258252903890793549897483872362043507,\
11330448751098045546614990567612096132290751751225546822371413732253437433478002901406535282761940023232557605690376224913895910240841519464567354770276551)
def F(x):
return (a*x*x + b*x + c)%d
def G(message):
n = len(message)
L = message[0:(n/2)]
R = message[(n/2):n]
L = int(L.encode("hex"), 16)
R = int(R.encode("hex"), 16)
return (L,R)
def fiestel(L, R):
rounds = 8
for i in xrange(rounds):
(L,R) = (R, L^F(R))
L = hex(L).replace("0x", "").replace("L", "")
R = hex(R).replace("0x", "").replace("L", "")
return R+L
test = "1SvXEaXhywrBE6DRX9zomKxKbZGYu46Tj7Z+oNrX0SxGU253OmLKDLHoO+LaJT2W+lPyQkWBToiPbo7wNz2lSIrTRT8yxV6AovUQO3Hvob33/hVfYmpHiytVwQ/dPmx+IQi7w+rTYZGro58FauonXu4hjwCnRaVYhwdjAvbC7cA="
test = b64decode(test)
(L,R) = G(test)
next_test = fiestel(L,R)
FLAG = next_test.decode("hex")
print(FLAG)
#1SvXEaXhywrBE6DRX9zomKxKbZGYu46Tj7Z+oNrX0SxGU253OmLKDLHoO+LaJT2W+lPyQkWBToiPbo7wNz2lSIrTRT8yxV6AovUQO3Hvob33/hVfYmpHiytVwQ/dPmx+IQi7w+rTYZGro58FauonXu4hjwCnRaVYhwdjAvbC7cA=