/** * Returns the sender object for the protocol. * * @return Returns the sender object for the protocol */ public CoteSender getSender() { if (sender == null) { this.sender = new CoteSender(resources, network); } return sender; }
/** * Constructs a new batch of correlated OTs with errors. * * @param size Amount of OTs to construct */ public List<StrictBitVector> extend(int size) { if (size < 1) { throw new IllegalArgumentException("The amount of OTs must be a positive integer"); } if (size % Byte.SIZE != 0) { throw new IllegalArgumentException( "The amount of OTs must be a positive integer divisible by 8"); } int bytesNeeded = size / Byte.SIZE; final List<StrictBitVector> tlist = prgs.parallelStream() .limit(resources.getComputationalSecurityParameter()) .map(drbg -> { byte[] bytes = new byte[bytesNeeded]; drbg.nextBytes(bytes); return bytes; }) .map(StrictBitVector::new) .collect(Collectors.toList()); final List<StrictBitVector> ulist = receiveList(resources.getComputationalSecurityParameter()); IntStream.range(0, resources.getComputationalSecurityParameter()).parallel() .filter(i -> otChoices.getBit(i, false)) .forEach(i -> tlist.get(i).xor(ulist.get(i))); return Transpose.transpose(tlist); }
/** * Construct a sending party for an instance of the correlated OT protocol. * * @param resources The common resource pool needed for OT extension * @param network The network interface. Must not be null and must be initialized. */ public CoteSender(OtExtensionResourcePool resources, Network network) { super(resources.getInstanceId()); this.prgs = new ArrayList<>(resources.getComputationalSecurityParameter()); for (StrictBitVector message : resources.getSeedOts().getLearnedMessages()) { // Initialize the PRGs with the random messages prgs.add(initPrg(message)); } otChoices = resources.getSeedOts().getChoices(); this.resources = resources; this.network = network; }
public RotSender createSender() { CoteSender sender = new CoteSender(resources, network); return new RotSenderImpl(sender, resources, network); }