Skip to content

Commit

Permalink
Replace Bouncy Castle Blake2bDigest in MaskedField
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 166c20d commit a4e7d6f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ dependencies {
implementation "org.bouncycastle:bcprov-jdk18on:${versions.bouncycastle}"
implementation 'org.ldaptive:ldaptive:1.2.3'
implementation 'com.nimbusds:nimbus-jose-jwt:9.37.3'
implementation 'com.rfksystems:blake2b:2.0.0'

//JWT
implementation "io.jsonwebtoken:jjwt-api:${jjwt_version}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@

import com.google.common.base.Splitter;
import org.apache.lucene.util.BytesRef;
import org.bouncycastle.crypto.digests.Blake2bDigest;
import org.bouncycastle.util.encoders.Hex;

import com.rfksystems.blake2b.Blake2b;

public class MaskedField {

private final String name;
Expand Down Expand Up @@ -164,10 +165,10 @@ private String customHash(String in) {
}

private byte[] blake2bHash(byte[] in) {
final Blake2bDigest hash = new Blake2bDigest(null, 32, defaultSalt, null);
final Blake2b hash = new Blake2b(null, 32, defaultSalt, null);
hash.update(in, 0, in.length);
final byte[] out = new byte[hash.getDigestSize()];
hash.doFinal(out, 0);
hash.digest(out, 0);
return Hex.encode(out);
}

Expand Down

0 comments on commit a4e7d6f

Please sign in to comment.