def save(self, filename, password, entropy): f=open(filename, 'w') for invite in self.invites: packet=InvitePacket() packet.createInvitePacket(password, invite, entropy) data=encode(packet.packet) f.write(data) f.write("\n") f.close()
def save(self, filename, password, entropy): f = open(filename, 'w') for invite in self.invites: packet = InvitePacket() packet.createInvitePacket(password, invite, entropy) data = encode(packet.packet) f.write(data) f.write("\n") f.close()
def load(self, filename, password): try: f=open(filename, 'r') except: print('No such file', filename) return for line in f.readlines(): data=decode(line.strip()) packet=InvitePacket() packet.decodeInvitePacket(password, data) if packet.checkMac(): self.addInvite(packet.invite) else: print('Mac check failed, possible a wrong password?') f.close()
def load(self, filename, password): try: f = open(filename, 'r') except: print('No such file', filename) return for line in f.readlines(): data = decode(line.strip()) packet = InvitePacket() packet.decodeInvitePacket(password, data) if packet.checkMac(): self.addInvite(packet.invite) else: print('Mac check failed, possible a wrong password?') f.close()