ctubbsii commented on code in PR #2707:
URL: https://github.com/apache/accumulo/pull/2707#discussion_r874762778
##########
server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKSecurityTool.java:
##########
@@ -114,16 +120,36 @@ public static byte[] createPass(byte[] password) throws
AccumuloException {
return cryptHash.getBytes(UTF_8);
}
+ private static final Cache<ByteBuffer,String> CRYPT_PASSWORD_CACHE =
+ Caffeine.newBuilder().scheduler(Scheduler.systemScheduler())
+
.expireAfterAccess(Duration.ofMinutes(1)).initialCapacity(4).maximumSize(64).build();
+
public static boolean checkCryptPass(byte[] password, byte[] zkData) {
Review Comment:
A brief comment stating the overall intent would be nice. The logic makes
sense now, but I realized that in future, somebody could wonder why we're
bothering to do this.
```suggestion
// This uses a cache to avoid repeated expensive calls to Crypt.crypt for
recent inputs
public static boolean checkCryptPass(byte[] password, byte[] zkData) {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]