alopresto commented on a change in pull request #3844: NIFI-1474 Added
validation for p in scrypt
URL: https://github.com/apache/nifi/pull/3844#discussion_r339188702
##########
File path:
nifi-commons/nifi-security-utils/src/test/groovy/org/apache/nifi/security/util/crypto/ScryptCipherProviderGroovyTest.groovy
##########
@@ -513,6 +513,81 @@ class ScryptCipherProviderGroovyTest {
assert params[2] == EXPECTED_P
}
+ @Test
+ void testShouldVerifyPBoundary() throws Exception {
+ // Arrange
+ final int r = 8;
+ final int p = 1;
+
+ // Act
+ boolean valid = ScryptCipherProvider.isPValid(r, p)
+
+ // Assert
+ assert valid
+ }
+
+ @Test
+ void testShouldFailPBoundary() throws Exception {
+ // Arrange
+ // The p upper bound is calculated with the formula below:
+ // pBoundary = ((Math.pow(2,32))-1) * (32.0/(r * 128)), where
pBoundary = 134217727.96875;
Review comment:
Update this comment to note that this particular `p` value is for `r = 8`.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services