Skip to content

Commit

Permalink
Fix Blake2b generation by passing salt correctly
Browse files Browse the repository at this point in the history
Signed-off-by: Terry Quigley <terry.quigley@sas.com>
  • Loading branch information
terryquigleysas committed Apr 18, 2024
1 parent 0bfe765 commit 02aa179
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ private String customHash(String in) {
}

private byte[] blake2bHash(byte[] in) {
final Blake2bDigest hash = new Blake2bDigest(null, 32, null, defaultSalt);
final Blake2bDigest hash = new Blake2bDigest(null, 32, defaultSalt, null);
hash.update(in, 0, in.length);
final byte[] out = new byte[hash.getDigestSize()];
hash.doFinal(out, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ public void testMaskedAggregationsRace() throws Exception {
Assert.assertTrue(res.getBody().contains("200.100"));
Assert.assertTrue(res.getBody().contains("\"doc_count\" : 30"));
Assert.assertTrue(res.getBody().contains("\"doc_count\" : 1"));
Assert.assertFalse(res.getBody().contains("e1623afebfa505884e249a478640ec98094d19a72ac7a89dd0097e28955bb5ae"));
Assert.assertFalse(res.getBody().contains("26a8671e57fefc13504f8c61ced67ac98338261ace1e5bf462038b2f2caae16e"));
Assert.assertFalse(res.getBody().contains("87873bdb698e5f0f60e0b02b76dad1ec11b2787c628edbc95b7ff0e82274b140"));
Assert.assertFalse(res.getBody().contains("4805f3596e68104d71b922124a61c701798180d5511a21586d9d8d58a1fc593f"));
Assert.assertFalse(res.getBody().contains("cf2061910587994e02f446d59d61d2dbabc5a3a8aea2fa05d08ffe2a12ee8bc8"));
Assert.assertFalse(res.getBody().contains("0e3f99018654fda6757601e88d4317f1649efae79126eb62c3f8c15105ba47ac"));

Assert.assertEquals(
HttpStatus.SC_OK,
Expand All @@ -164,9 +164,9 @@ public void testMaskedAggregationsRace() throws Exception {
Assert.assertTrue(res.getBody().contains("\"doc_count\" : 1"));
Assert.assertFalse(res.getBody().contains("100.100"));
Assert.assertFalse(res.getBody().contains("200.100"));
Assert.assertTrue(res.getBody().contains("e1623afebfa505884e249a478640ec98094d19a72ac7a89dd0097e28955bb5ae"));
Assert.assertTrue(res.getBody().contains("26a8671e57fefc13504f8c61ced67ac98338261ace1e5bf462038b2f2caae16e"));
Assert.assertTrue(res.getBody().contains("87873bdb698e5f0f60e0b02b76dad1ec11b2787c628edbc95b7ff0e82274b140"));
Assert.assertTrue(res.getBody().contains("4805f3596e68104d71b922124a61c701798180d5511a21586d9d8d58a1fc593f"));
Assert.assertTrue(res.getBody().contains("cf2061910587994e02f446d59d61d2dbabc5a3a8aea2fa05d08ffe2a12ee8bc8"));
Assert.assertTrue(res.getBody().contains("0e3f99018654fda6757601e88d4317f1649efae79126eb62c3f8c15105ba47ac"));

for (int i = 0; i < 10; i++) {
Assert.assertEquals(
Expand All @@ -177,9 +177,9 @@ public void testMaskedAggregationsRace() throws Exception {
Assert.assertTrue(res.getBody().contains("200.100"));
Assert.assertTrue(res.getBody().contains("\"doc_count\" : 30"));
Assert.assertTrue(res.getBody().contains("\"doc_count\" : 1"));
Assert.assertFalse(res.getBody().contains("e1623afebfa505884e249a478640ec98094d19a72ac7a89dd0097e28955bb5ae"));
Assert.assertFalse(res.getBody().contains("26a8671e57fefc13504f8c61ced67ac98338261ace1e5bf462038b2f2caae16e"));
Assert.assertFalse(res.getBody().contains("87873bdb698e5f0f60e0b02b76dad1ec11b2787c628edbc95b7ff0e82274b140"));
Assert.assertFalse(res.getBody().contains("4805f3596e68104d71b922124a61c701798180d5511a21586d9d8d58a1fc593f"));
Assert.assertFalse(res.getBody().contains("cf2061910587994e02f446d59d61d2dbabc5a3a8aea2fa05d08ffe2a12ee8bc8"));
Assert.assertFalse(res.getBody().contains("0e3f99018654fda6757601e88d4317f1649efae79126eb62c3f8c15105ba47ac"));
}

}
Expand All @@ -201,7 +201,7 @@ public void testMaskedSearch() throws Exception {
Assert.assertTrue(res.getBody().contains("cust2"));
Assert.assertTrue(res.getBody().contains("100.100.1.1"));
Assert.assertTrue(res.getBody().contains("100.100.2.2"));
Assert.assertFalse(res.getBody().contains("87873bdb698e5f0f60e0b02b76dad1ec11b2787c628edbc95b7ff0e82274b140"));
Assert.assertFalse(res.getBody().contains("0e3f99018654fda6757601e88d4317f1649efae79126eb62c3f8c15105ba47ac"));

Assert.assertEquals(
HttpStatus.SC_OK,
Expand All @@ -213,7 +213,7 @@ public void testMaskedSearch() throws Exception {
Assert.assertTrue(res.getBody().contains("cust2"));
Assert.assertFalse(res.getBody().contains("100.100.1.1"));
Assert.assertFalse(res.getBody().contains("100.100.2.2"));
Assert.assertTrue(res.getBody().contains("87873bdb698e5f0f60e0b02b76dad1ec11b2787c628edbc95b7ff0e82274b140"));
Assert.assertTrue(res.getBody().contains("0e3f99018654fda6757601e88d4317f1649efae79126eb62c3f8c15105ba47ac"));

}

Expand All @@ -233,7 +233,7 @@ public void testMaskedGet() throws Exception {
Assert.assertFalse(res.getBody().contains("cust2"));
Assert.assertTrue(res.getBody().contains("100.100.1.1"));
Assert.assertFalse(res.getBody().contains("100.100.2.2"));
Assert.assertFalse(res.getBody().contains("87873bdb698e5f0f60e0b02b76dad1ec11b2787c628edbc95b7ff0e82274b140"));
Assert.assertFalse(res.getBody().contains("0e3f99018654fda6757601e88d4317f1649efae79126eb62c3f8c15105ba47ac"));

Assert.assertEquals(
HttpStatus.SC_OK,
Expand All @@ -244,7 +244,7 @@ public void testMaskedGet() throws Exception {
Assert.assertFalse(res.getBody().contains("cust2"));
Assert.assertFalse(res.getBody().contains("100.100.1.1"));
Assert.assertFalse(res.getBody().contains("100.100.2.2"));
Assert.assertTrue(res.getBody().contains("87873bdb698e5f0f60e0b02b76dad1ec11b2787c628edbc95b7ff0e82274b140"));
Assert.assertTrue(res.getBody().contains("0e3f99018654fda6757601e88d4317f1649efae79126eb62c3f8c15105ba47ac"));
}

}

0 comments on commit 02aa179

Please sign in to comment.