diff options
Diffstat (limited to 'game/vault.rpy')
-rw-r--r-- | game/vault.rpy | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/game/vault.rpy b/game/vault.rpy index 17678ee..bbe9fc3 100644 --- a/game/vault.rpy +++ b/game/vault.rpy @@ -54,7 +54,10 @@ init python: self.variable = str(persistent.email) uedit[key] = str(self.variable) if (persistent.passd is not None and self.variable == "***"): - self.variable = str(bytearray((x ^ (persistent.rhash/mp.sub) for x in bytearray(persistent.passd, 'utf-8')))) + if LEGACY: + self.variable = str(bytearray((x ^ int(persistent.rhash/mp.sub) for x in bytearray(persistent.passd, 'utf-8')))) + else: + self.variable = bytearray((x ^ int(persistent.rhash/mp.sub) for x in persistent.passd)).decode('utf-8') uedit[key] = str(self.variable) def get_text(self): @@ -181,7 +184,10 @@ label register_vault: key = base64.b32decode(persistent.totp.encode('utf-8'), True) msg = struct.pack(">Q", int(time.time()/30)) h = hmac.new(key, msg, hashlib.sha1).digest() - o = ord(h[19]) & 15 + if LEGACY: + o = ord(h[19]) & 15 + else: + o = (h[19] & 15) _return = (struct.unpack(">I", h[o:o+4])[0] & 0x7fffffff) % 1000000 _return = "%06d" % _return print("TOTP: %s" % _return) @@ -206,7 +212,10 @@ label register_vault: $ hsh = renpy.random.randint(11, 127) $ mp.sub = renpy.random.randint(127, 16777215) $ persistent.rhash = int(hsh)*mp.sub - $ persistent.passd = str(bytearray(x ^ hsh for x in bytearray(password, 'utf-8'))) + if LEGACY: + $ persistent.passd = str(bytearray(x ^ int(hsh) for x in bytearray(password, 'utf-8'))) + else: + $ persistent.passd = bytearray(ord(x) ^ int(hsh) for x in password) $ mp.save() # Wait for Vault to confirm. |