'Sets the key and performs key expansion.'

def setkey(self, key):

    self.key = key
    self.key_size = len(key)
    if (self.key_size == 16):
        self.rounds = 10
    elif (self.key_size == 24):
        self.rounds = 12
    elif (self.key_size == 32):
        self.rounds = 14
    else:
        raise ValueError, 'Key    length    must    be    16,    24    or    32    bytes'
    self.expand_key()
