<s> """<STR_LIT>""" <EOL> from RC4 import RC4 <EOL> from cryptomath import * <EOL> def new ( key ) : <EOL> return Python_RC4 ( key ) <EOL> class Python_RC4 ( RC4 ) : <EOL> def __init__ ( self , key ) : <EOL> RC4 . __init__ ( self , key , "<STR_LIT>" ) <EOL> keyBytes = stringToBytes ( key ) <EOL> S = [ i for i in range ( <NUM_LIT> ) ] <EOL> j = <NUM_LIT:0> <EOL> for i in range ( <NUM_LIT> ) : <EOL> j = ( j + S [ i ] + keyBytes [ i % len ( keyBytes ) ] ) % <NUM_LIT> <EOL> S [ i ] , S [ j ] = S [ j ] , S [ i ] <EOL> self . S = S <EOL> self . i = <NUM_LIT:0> <EOL> self . j = <NUM_LIT:0> <EOL> def encrypt ( self , plaintext ) : <EOL> plaintextBytes = stringToBytes ( plaintext ) <EOL> S = self . S <EOL> i = self . i <EOL> j = self . j <EOL> for x in range ( len ( plaintextBytes ) ) : <EOL> i = ( i + <NUM_LIT:1> ) % <NUM_LIT> <EOL> j = ( j + S [ i ] ) % <NUM_LIT> <EOL> S [ i ] , S [ j ] = S [ j ] , S [ i ] <EOL> t = ( S [ i ] + S [ j ] ) % <NUM_LIT> <EOL> plaintextBytes [ x ] ^= S [ t ] <EOL> self . i = i <EOL> self . j = j <EOL> return bytesToString ( plaintextBytes ) <EOL> def decrypt ( self , ciphertext ) : <EOL> return self . encrypt ( ciphertext ) </s>
