Github user jacobwil commented on a diff in the pull request:
https://github.com/apache/incubator-pirk/pull/111#discussion_r85344830
--- Diff:
src/main/java/org/apache/pirk/querier/wideskies/encrypt/EncryptQuery.java ---
@@ -156,10 +149,23 @@ public Querier encrypt(int numThreads) throws
InterruptedException, PIRException
return new Querier(selectors, paillier, query, embedSelectorMap);
}
+ /**
+ * Use this method to get a securely generated, random string of
2*numBytes length
+ *
+ * @param numBytes How many bytes of random data to return.
+ * @return Random hex string of 2*numBytes length
+ */
+ private String getRandByteString(int numBytes)
+ {
+ byte[] randomData = new byte[numBytes];
+ RandomProvider.SECURE_RANDOM.nextBytes(randomData);
+ return Hex.encodeHexString(randomData);
+ }
+
private Map<Integer,Integer> computeSelectorQueryVecMap()
{
- String hashKey = queryInfo.getHashKey();
- int keyCounter = 0;
+ String hashKeyBase = queryInfo.getHashKey();
+ String hashKey = hashKeyBase + getRandByteString(10);
--- End diff --
I will swear up and down that I already made this change and then wiped it
out with a `git checkout` after I massively broke the codebase with an
ill-fated IntelliJ assisted refactor. Putting it back now.
---
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.
---