diff --git a/syncplay/client.py b/syncplay/client.py index 772be2a..32b7b02 100644 --- a/syncplay/client.py +++ b/syncplay/client.py @@ -90,7 +90,7 @@ class SyncplayClient(object): self.setUsername(config['name']) self.setRoom(config['room']) if config['password']: - config['password'] = hashlib.md5(config['password']).hexdigest() + config['password'] = hashlib.sha512(config['password']).hexdigest() self._serverPassword = config['password'] if not config['file']: self.__getUserlistOnLogon = True diff --git a/syncplay/protocols.py b/syncplay/protocols.py index c0055be..e58af20 100644 --- a/syncplay/protocols.py +++ b/syncplay/protocols.py @@ -342,11 +342,11 @@ class SyncServerProtocol(JSONCommandProtocol): return username, serverPassword, roomName, version def _checkPassword(self, serverPassword): - if self._factory.password: + if self._factory.password_sha512 or self._factory.password_md5: if not serverPassword: self.dropWithError(getMessage("password-required-server-error")) return False - if serverPassword != self._factory.password: + if serverPassword != self._factory.password_md5 and serverPassword != self._factory.password_sha512: self.dropWithError(getMessage("wrong-password-server-error")) return False return True diff --git a/syncplay/server.py b/syncplay/server.py index 399325a..f25a210 100644 --- a/syncplay/server.py +++ b/syncplay/server.py @@ -18,8 +18,10 @@ class SyncFactory(Factory): self.isolateRooms = isolateRooms print getMessage("welcome-server-notification").format(syncplay.version) if password: - password = hashlib.md5(password).hexdigest() - self.password = password + password_sha512 = hashlib.sha512(password).hexdigest() + password_md5 = hashlib.md5(password).hexdigest() + self.password_sha512 = password_sha512 + self.password_md5 = password_md5 if salt is None: salt = RandomStringGenerator.generate_server_salt() print getMessage("no-salt-notification").format(salt)