예제 #1
0
파일: invite.py 프로젝트: blanu/Dust
  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()
예제 #3
0
파일: invite.py 프로젝트: blanu/Dust
  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()