def setKey(self, key):
self.key_size = <NUM_LIT>  <EOL>if len(key) != self.key_size:<EOL><INDENT>if len(key) == <NUM_LIT:16>: <EOL><INDENT>self.key_size = <NUM_LIT:16><EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>if self.getMode() == CBC:<EOL><INDENT>if not self.getIV():<EOL><INDENT>self._iv = key[:self.block_size]<EOL><DEDENT>if len(self.getIV()) != self.block_size:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>self.__key1 = des(key[:<NUM_LIT:8>], self._mode, self._iv,<EOL>self._padding, self._padmode)<EOL>self.__key2 = des(key[<NUM_LIT:8>:<NUM_LIT:16>], self._mode, self._iv,<EOL>self._padding, self._padmode)<EOL>if self.key_size == <NUM_LIT:16>:<EOL><INDENT>self.__key3 = self.__key1<EOL><DEDENT>else:<EOL><INDENT>self.__key3 = des(key[<NUM_LIT:16>:], self._mode, self._iv,<EOL>self._padding, self._padmode)<EOL><DEDENT>_baseDes.setKey(self, key)<EOL>
Will set the crypting key for this object. Either 16 or 24 bytes long.