# -*- coding: utf8 -*-
ji="JPyjup3eCyJjlkV6DmSmGHQ="
lis=ji.decode("base64")
print lis.encode("hex")
key=[0xB7,0x6B,0xA6,0xDC,0x11,0x5B,0x05,0x5A,0x78,0x00,0x74,0xB2,0x43,0x30,0x01,0xBE,0xED,0x26,0x09,0xC7,0x31,0x45,0xCE,0xCF,0x91,0x70,0xC6,0xB1,0x5E,0x61,0x55,0x15,0xBD,0x1A,0x4B,0xC5,0xF6,0x22,0xA2,0x72,0xFF,0x42,0xF3,0x6A,0x8F,0x87,0x02,0xDF,0x6F,0xB0,0xBA,0xA4,0x85,0xEA,0x8E,0x32,0xA1,0x2D,0xEF,0xAA,0xE3,0xA3,0xBF,0x2C,0xE0,0x47,0x3D,0x08,0xB9,0xCC,0x7D,0x7F,0x6D,0x7A,0x12,0x1C,0xDB,0x94,0xFC,0xC0,0xAF,0x0C,0x62,0x14,0x59,0x24,0xE8,0x4C,0xCB,0xCD,0x60,0x39,0xC9,0x3A,0x98,0x77,0xE2,0xAB,0xB8,0xD7,0x3C,0x69,0x53,0x1F,0xCA,0x88,0x51,0x4D,0x8A,0x36,0xE7,0xAE,0xD2,0xD1,0xFB,0x8B,0x5D,0x0D,0xA8,0x8D,0x0A,0x10,0x82,0xD4,0x0E,0x2F,0x57,0x5C,0x20,0x3E,0xD0,0xB6,0xBC,0x33,0x4E,0x90,0x17,0xF2,0xB5,0x03,0x79,0x99,0x2B,0xFD,0xAD,0xA5,0x04,0x16,0x40,0x3B,0x07,0x9E,0xDD,0x48,0x2E,0x25,0x27,0xA7,0x89,0xF9,0x95,0x68,0x1B,0x6E,0x84,0xF7,0xC4,0xC8,0x71,0x6C,0x86,0x29,0xB3,0xEC,0x92,0x80,0x4F,0x41,0xB4,0xD8,0x58,0x1D,0xD6,0x44,0x49,0x81,0x3F,0x67,0x96,0x35,0xAC,0x21,0xE9,0x64,0x56,0x19,0x9B,0xD9,0xC3,0xBB,0x4A,0xD3,0xE6,0xE4,0x9D,0xD5,0x8C,0x06,0x83,0x7C,0x9C,0xC1,0xFA,0x93,0x97,0x76,0xDA,0x38,0x73,0x18,0x28,0x13,0xF4,0x0F,0x23,0x52,0x9A,0x7B,0xA9,0xF8,0x9F,0x50,0x65,0xF1,0x34,0xEE,0xA0,0x37,0x46,0xE5,0x5F,0x75,0x7E,0xC2,0xEB,0x66,0xDE,0xFE,0xF5,0x0B,0x2A,0xF0,0x63,0xE1,0x1E,0x54]
def getkey(key,le):
xorkey=[]
keys=[]
for kk in key:
keys.append(kk)
i=0
j=0
for k in range(0,le):
i=(i+1)%256
j=(j+keys[i])%256
keys[i],keys[j]=keys[j],keys[i]
xorkey.append(keys[(keys[i]+keys[j])%256])
return xorkey
def rc4de(inp):
innp=list(inp)
#print innp
out=""
le=len(innp)
#print le
xorkey=getkey(key,le)
for k in range(0,le):
out+=chr(xorkey[k]^ord(innp[k]))
return out
def rc4en(inp):
return rc4de(inp)
print rc4de(lis)
print "我爱你".encode('hex')
print rc4en("我爱你").encode('hex')
print rc4de("af15563877168aedaa".decode('hex'))