コード例 #1
0
        public Task <PreprocessedReceiverBatch> PreprocessReceiverAsync(IMessageChannel channel, int numberOfInvocations)
        {
            byte[] randomSelectionIndicesBuffer        = _randomNumberGenerator.GetBytes(QuadrupleIndexArray.RequiredBytes(numberOfInvocations));
            QuadrupleIndexArray randomSelectionIndices = QuadrupleIndexArray.FromBytes(randomSelectionIndicesBuffer, numberOfInvocations);

            return(_obliviousTransfer.ReceiveAsync(channel, randomSelectionIndices, numberOfInvocations)
                   .ContinueWith(task => new PreprocessedReceiverBatch(randomSelectionIndices, task.Result)));
        }
コード例 #2
0
        private Task <BitArray> ComputeReceiverSharesAsync(IMessageChannel channel, BitArray leftShares, BitArray rightShares, int numberOfInvocations)
        {
            QuadrupleIndexArray selectionIndices = new QuadrupleIndexArray(numberOfInvocations);

            for (int i = 0; i < numberOfInvocations; ++i)
            {
                selectionIndices[i] = 2 * (byte)leftShares[i] + (byte)rightShares[i];
            }

            return(_obliviousTransfer.ReceiveAsync(channel, selectionIndices, numberOfInvocations));
        }