in protocol/src/private_id_multi_key/company.rs [433:472]
fn write_company_to_id_map(&self) {
match (
self.permutation.clone().read(),
self.w_company.clone().read(),
self.s_prime_partner.clone().read(),
self.id_map.clone().write(),
) {
(Ok(permutation), Ok(company), Ok(partner), Ok(mut id_map)) => {
let company_encrypt = {
let mut out = company.clone();
undo_permute(permutation.as_slice(), &mut out);
self.ec_cipher
.to_points_encrypt(out.as_slice(), &self.private_keys.2.invert())
};
id_map.clear();
for (idx, k) in self.ec_cipher.to_bytes(&company_encrypt).iter().enumerate() {
id_map.push((k.to_string(), idx, true));
}
for (idx, k) in self
.ec_cipher
.to_bytes(
&self
.ec_cipher
.to_points_encrypt(&partner, &self.private_keys.1),
)
.iter()
.enumerate()
{
id_map.push((k.to_string(), idx, false));
}
// Sort the id_map by the spine
id_map.sort_by(|(a, _, _), (b, _, _)| a.cmp(b));
}
_ => panic!("Cannot create id_map"),
}
}