Ejemplo n.º 1
0
    def __realMix(self, message, path, tempProcess=None):
        temp = message.permute(self.permutation[path])
        result = Vector([
            CyclicGroupVector.scalarMultiply(temp.at(i),
                                             self.S[path].array.at(i))
            for i in range(0, self.b)
        ])
        if not self.__finalNode(path):
            self.__toNextNode(
                path,
                Message(self.realMixCallback[path],
                        [v.vector for v in result.vector]))
        else:
            self.network.broadcastToNodes(
                self.id,
                Message(self.mixCommitCallback[path],
                        [v.vector for v in result.vector]))
            temp = CyclicGroupVector.multiply(self.decryptionShare[path],
                                              self.mixMessageComponents[path])
            if tempProcess is not None:
                temp = tempProcess(temp)

            result = Vector([
                CyclicGroupVector.scalarMultiply(result.at(i), temp.at(i))
                for i in range(0, self.b)
            ])
            self.network.sendToNH(
                Message(self.realPostProcessCallback[path],
                        [True, [v.vector for v in result.vector]]))
        return Status.OK
Ejemplo n.º 2
0
 def realForPreProcess(self, message):
     self.senders = message.payload
     cyclicVector = self.keyManager.getNextKeys(ids=self.senders,
                                                type=KeyManager.MESSAGE,
                                                inverse=False)
     product = CyclicGroupVector.multiply(cyclicVector, self.r.array)
     self.network.sendToNH(
         Message(Callback.REAL_FOR_PREPROCESS, product.vector))
     return Status.OK
Ejemplo n.º 3
0
 def __appendDecrShare(self, payload, path):
     if self.decryptionShares[path] is None:
         self.decryptionShares[path] = payload
     else:
         if self.mixResult[path] is None:
             self.decryptionShares[path] = CyclicGroupVector.multiply(
                 self.decryptionShares[path], payload)
         else:
             self.decryptionShares[path] = payload
Ejemplo n.º 4
0
 def __returnPathKeyBlinding(self, temp):
     return CyclicGroupVector.multiply(
         temp,
         self.keyManager.getNextKeys(ids=self.senders,
                                     type=KeyManager.RESPONSE,
                                     inverse=False))