def cipher_functions(username, password): from sysident import sysident mach_key = sysident() digest = sha1(username + password).digest() assert len(mach_key) == len(digest) key = strings.string_xor(digest, mach_key) return crypto.cipher_functions(key[-16:], mode=crypto.Mode.CBC)
def _get_key(self, keymat=''): keys = getattr(self, '_keys', None) if keys is None: keys = self._keys = {} key = keys.get(keymat, None) if key is not None: return key self._keys[keymat] = sysident.sysident(append=keymat) return self._keys[keymat]