Each player must perform a shuffle of the deck, because only such a procedure guarantees that no coalition has influence on the outcome. Thus we build a shuffle chain such that every player shuffles the deck. Consider the code fragment for the player P_j.
The regular stack s
is initialized with open cards from deck
.
Then each player shuffles the stack (see TMCG_MixStack
) and proves the
correctness of this operation (see TMCG_ProveStackEquality
). Consequently,
every player should verify these proofs (see TMCG_VerifyStackEquality
).
Finally, the stack s
contains the shuffled result.
TMCG_Stack<VTMF_Card> s; s.push(deck); for (size_t i = 0; i < 5; i++) { TMCG_Stack<VTMF_Card> s2; if (i == j) { TMCG_StackSecret<VTMF_CardSecret> ss; tmcg->TMCG_CreateStackSecret(ss, false, s.size(), vtmf); tmcg->TMCG_MixStack(s, s2, ss, vtmf); for (size_t i2 = 0; i2 < 5; i2++) { if (i2 == j) continue; out_stream[i2] << s2 << std::endl; tmcg->TMCG_ProveStackEquality(s, s2, ss, false, vtmf, in_stream[i2], out_stream[i2]); } } else { in_stream[i] >> s2; if (!in_stream[i].good()) std::cerr << "Read or parse error!" << std::endl; if (!tmcg->TMCG_VerifyStackEquality(s, s2, false, vtmf, in_stream[i], out_stream[i])) std::cerr << "Verification failed!" << std::endl; } s = s2; } |
If you want to use the more efficient shuffle verification protocol of Groth,
then you must simply replace TMCG_ProveStackEquality
and
TMCG_VerifyStackEquality
by TMCG_ProveStackEquality_Groth
and
TMCG_VerifyStackEquality_Groth
, respectively.