2
0

Refactoring masterpassword-algorithm.

This commit is contained in:
Maarten Billemont
2018-05-16 00:12:31 -04:00
parent 8bdf1755b7
commit 0aa7baf59e
24 changed files with 468 additions and 479 deletions

View File

@@ -168,17 +168,13 @@ public class MPTestSuite implements Callable<Boolean> {
@Override
public Boolean call()
throws Exception {
return forEach( "mpw", new TestCase() {
@Override
public boolean run(final MPTests.Case testCase)
throws Exception {
MPMasterKey masterKey = new MPMasterKey( testCase.getFullName(), testCase.getMasterPassword().toCharArray() );
String sitePassword = masterKey.siteResult( testCase.getSiteName(), testCase.getSiteCounter(), testCase.getKeyPurpose(),
testCase.getKeyContext(), testCase.getResultType(),
null, testCase.getAlgorithm() );
return forEach( "mpw", testCase -> {
MPMasterKey masterKey = new MPMasterKey( testCase.getFullName(), testCase.getMasterPassword().toCharArray() );
String sitePassword = masterKey.siteResult( testCase.getSiteName(), testCase.getAlgorithm(), testCase.getSiteCounter(),
testCase.getKeyPurpose(), testCase.getKeyContext(),
testCase.getResultType(), null );
return testCase.getResult().equals( sitePassword );
}
return testCase.getResult().equals( sitePassword );
} );
}
@@ -192,12 +188,14 @@ public class MPTestSuite implements Callable<Boolean> {
}
@FunctionalInterface
public interface Listener {
void progress(int current, int max, String messageFormat, Object... args);
}
@FunctionalInterface
public interface TestCase {
boolean run(MPTests.Case testCase)

View File

@@ -176,7 +176,7 @@ public class MPTests {
@Nonnull
public MPAlgorithm getAlgorithm() {
return MPMasterKey.Version.fromInt( checkNotNull( algorithm ) ).getAlgorithm();
return MPAlgorithm.Version.fromInt( checkNotNull( algorithm ) ).getAlgorithm();
}
@Nonnull