createShare static method
Implementation
static Future<bool> createShare() {
secret = List.generate(bits.length, (i) => List.generate(8, (j) => 0));
candidateArray =
List.generate(bits.length, (i) => List.generate(8, (j) => 0));
SecretShare share = SecretShare(0);
StringBuffer cnd = StringBuffer();
StringBuffer pvt = StringBuffer();
for (int i = 0; i < bits.length; i++) {
if (bits.substring(i, i + 1) == '0') {
share = SecretShare(0);
share.starts();
for (int j = 0; j < 8; j++) {
secret[i][j] = SecretShare.s0[j];
candidateArray[i][j] = SecretShare.y1[j];
pvt.write(SecretShare.s0[j].toString());
cnd.write(SecretShare.y1[j].toString());
}
}
if (bits.substring(i, i + 1) == '1') {
share = SecretShare(1);
share.starts();
for (int j = 0; j < 8; j++) {
secret[i][j] = SecretShare.s0[j];
candidateArray[i][j] = SecretShare.y1[j];
pvt.write(SecretShare.s0[j].toString());
cnd.write(SecretShare.y1[j].toString());
}
}
}
privateShare = pvt.toString();
candidateShare = cnd.toString();
return checkShare();
}