Github user ellisonanne commented on a diff in the pull request:
https://github.com/apache/incubator-pirk/pull/81#discussion_r76517300
--- Diff:
src/main/java/org/apache/pirk/querier/wideskies/encrypt/EncryptQuery.java ---
@@ -56,103 +56,84 @@
{
private static final Logger logger =
LoggerFactory.getLogger(EncryptQuery.class);
- private final QueryInfo queryInfo; // contains basic query information
and functionality
+ // Contains basic query information.
+ private final QueryInfo queryInfo;
- private Query query = null; // contains the query vectors
+ // Selectors for this query.
+ private final List<String> selectors;
- private Querier querier = null; // contains the query vectors and
encryption object
+ // Paillier encryption functionality.
+ private final Paillier paillier;
- private final Paillier paillier; // Paillier encryption functionality
-
- private List<String> selectors = null; // selectors for the query
-
- // Map to check the embedded selectors in the results for false
positives;
- // if the selector is a fixed size < 32 bits, it is included as is
- // if the selector is of variable lengths
- private HashMap<Integer,String> embedSelectorMap = null;
-
- public EncryptQuery(QueryInfo queryInfoInput, List<String>
selectorsInput, Paillier paillierInput)
- {
- queryInfo = queryInfoInput;
-
- selectors = selectorsInput;
-
- paillier = paillierInput;
-
- embedSelectorMap = new HashMap<>();
- }
-
- public Paillier getPaillier()
- {
- return paillier;
- }
-
- public QueryInfo getQueryInfo()
- {
- return queryInfo;
- }
-
- public Query getQuery()
- {
- return query;
- }
-
- public Querier getQuerier()
- {
- return querier;
- }
-
- public List<String> getSelectors()
- {
- return selectors;
- }
-
- public HashMap<Integer,String> getEmbedSelectorMap()
+ /**
+ * Constructs a query encryptor using the given query information,
selectors, and Paillier cryptosystem.
+ *
+ * @param queryInfo
+ * Fundamental information about the query.
+ * @param selectors
+ * the list of selectors for this query.
+ * @param paillier
+ * the Paillier cryptosystem to use.
+ */
+ public EncryptQuery(QueryInfo queryInfo, List<String> selectors,
Paillier paillier)
{
- return embedSelectorMap;
+ this.queryInfo = queryInfo;
+ this.selectors = selectors;
+ this.paillier = paillier;
}
/**
- * Encrypt, building the Query object, calculating and setting the query
vectors.
+ * Encrypts the query described by the query information using Paillier
encryption.
+ * <p>
+ * The encryption builds a <code>Querier</code> object, calculating and
setting the query vectors.
* <p>
* Uses the system configured number of threads to conduct the
encryption, or a single thread if the configuration has not been set.
*
* @throws InterruptedException
- * if the task was interrupted during encryption.
+ * If the task was interrupted during encryption.
* @throws PIRException
+ * If a problem occurs performing the encryption.
+ * @return The querier containing the query, and all information
required to perform decryption.
*/
- public void encrypt() throws InterruptedException, PIRException
+ public Querier encrypt() throws InterruptedException, PIRException
{
int numThreads = SystemConfiguration.getIntProperty("numThreads", 1);
- encrypt(numThreads);
+ return encrypt(numThreads);
}
/**
- * Encrypt, building the Query object, calculating and setting the query
vectors
- * <p>
- * If we have hash collisions over our selector set, we will append
integers to the key starting with 0 until we no longer have collisions.
- * <p>
- * For encrypted query vector E = <E_0, ..., E_{(2^hashBitSize)-1}>:
+ * Encrypts the query described by the query information using Paillier
encryption using the given number of threads.
* <p>
- * E_i = 2^{j*dataPartitionBitSize} if i = H_k(selector_j) 0 otherwise
--- End diff --
Can we please leave in the E_i definition for this javadoc?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---