コード例 #1
0
ファイル: kzg.py プロジェクト: tyurek/distcrs
 def inc_knowledge_proof(proofs, alpha):
     old_g_alpha = proofs[-1][0]
     new_g_alpha = old_g_alpha * alpha
     proofs.append(
         [new_g_alpha,
          ProveDL([old_g_alpha, new_g_alpha], alpha)])
     return proofs
コード例 #2
0
ファイル: babysnark.py プロジェクト: tyurek/distcrs
    def inc_knowledge_proof(proofs, beta_i):
        old_g_gammabeta = proofs[-1][0]
        new_g_gammabeta = old_g_gammabeta * beta_i

        proof = ProveDL([old_g_gammabeta, new_g_gammabeta], beta_i)
        proofs.append([new_g_gammabeta, proof])
        return proofs
コード例 #3
0
ファイル: babysnark1r.py プロジェクト: tyurek/distcrs
 def prove_knowledge(oldcrs, newcrs, trapdoors_i):
     old_comms = [oldcrs[2][1], oldcrs[3][0], oldcrs[0]]
     new_comms = [newcrs[2][1], newcrs[3][0], newcrs[0]]
     #alpha_i, beta_i, gamma_i = trapdoors_i
     DLProofs = [
         ProveDL([old_comms[i], new_comms[i]], trapdoors_i[i])
         for i in range(3)
     ]
     #start a list of proofs (which are themselves lists) for easy appending later
     return [[new_comms, DLProofs]]
コード例 #4
0
ファイル: babysnark.py プロジェクト: tyurek/distcrs
 def prove_knowledge(oldcrs, newcrs, beta_i):
     if len(oldcrs) == 2:
         old_comm = oldcrs[0]
     else:
         old_comm = oldcrs[2]
     new_comm = newcrs[2]
     #alpha_i, gamma_i = trapdoors_i
     proof = ProveDL([old_comm, new_comm], beta_i)
     #start a list of proofs (which are themselves lists) for easy appending later
     return [[new_comm, proof]]
コード例 #5
0
ファイル: babysnark.py プロジェクト: tyurek/distcrs
    def inc_knowledge_proof(proofs, trapdoors_i):
        old_comms = proofs[-1][0]
        old_g_alpha, old_g_gamma = old_comms
        alpha_i, gamma_i = trapdoors_i

        new_g_alpha = old_g_alpha * alpha_i
        new_g_gamma = old_g_gamma * gamma_i
        new_comms = [new_g_alpha, new_g_gamma]

        DLProofs = [
            ProveDL([old_comms[i], new_comms[i]], trapdoors_i[i])
            for i in range(2)
        ]
        proofs.append([new_comms, DLProofs])
        return proofs
コード例 #6
0
ファイル: kzg.py プロジェクト: tyurek/distcrs
 def prove_knowledge(oldcrs, newcrs, alpha):
     old_g_alpha, new_g_alpha = [oldcrs[1], newcrs[1]]
     #start a list of proofs (which are themselves lists) for easy appending later
     return [[new_g_alpha, ProveDL([old_g_alpha, new_g_alpha], alpha)]]