def encipher_vigenere(msg, key, symbols=None):
 (msg, key, A) = _prep(msg, key, symbols)
 map = {c: i for (i, c) in enumerate(A)}
 key = [map[c] for c in key]
 N = len(map)
 k = len(key)
 rv = []
 for (i, m) in enumerate(msg):
  rv.append(A[((map[m] + key[(i % k)]) % N)])
 rv = ''.join(rv)
 return rv

def encipher_vigenere ( msg , key , symbols = None ) : ( msg , key , A ) = _prep ( msg , key , symbols ) map = { c : i for ( i , c ) in enumerate ( A ) } key = [ map [ c ] for c in key ] N = len ( map ) k = len ( key ) rv = [ ] for ( i , m ) in enumerate ( msg ) : rv . append ( A [ ( ( map [ m ] + key [ ( i % k ) ] ) % N ) ] ) rv = '' . join ( rv ) return rv
performs the vigenère cipher encryption on plaintext msg .