def __init__ (self, eid, mask, ts, ack, otp):
   self.msg_type = MSG_OTP_ACK
   self.eid = IPAddr(eid)		#EID to register
   #self.mask = struct.pack('>I', mask)#EID mask
   self.mask = mask
   gammaplain = Gamma(eid, mask, ts, ack, otp)
   self.gamma = gammaplain.encrypt()
   return
Пример #2
0
 def append(self, item):
     pre = self.head
     curr = self.head
     temp = item[0]
     if self.head == 0:
         self.head = Node(item)
         return
     else:
         val = curr.docno
         curr = curr.next
         while curr != 0:
             val += Gamma.__gammaUncompress__(curr.docno)
             pre = curr
             curr = curr.next
         # val += Gamma.__gammaUncompress__(curr.docno)
         item[0] = Gamma.__gamma__(temp - val)
         pre.next = Node(item)
Пример #3
0
 def output(self):
     p = self.head
     if p == 0:
         print('empty')
     s = ''
     count = p.docno
     s += str(count)+','+str(p.tf)+'|'
     p = p.next
     while p != 0:
         # print(count)
         count += Gamma.__gammaUncompress__(p.docno)
         s += str(count)+','+str(p.tf)+'|'
         p = p.next
     return s
Пример #4
0
 def increase(self, docno):
     if self.is_empty():
         # print('Linklist is empty.')
         return False
     p = self.head
     docno_val = p.docno
     while p.next != 0 and not docno_val == docno:   # 匹配docno
         p = p.next
         docno_val += Gamma.__gammaUncompress__(p.docno) # 解压?没懂
     if docno_val == docno:
         p.tf += 1   # 词项频率加一
         return True
     else:
         return False
Пример #5
0
 def increase(self,value):
     if self.is_empty():
         #print('Linklist is empty.')
         return False
     p = self.head
     docno_val=p.docno
     while p.next!=0 and not docno_val == value:
         p = p.next
         docno_val += Gamma.__gammaUncompress__(p.docno)
     if docno_val == value:
         p.tf+=1
         return True
     else:
         return False