diff --git a/Tests/ERXTest/Sources/er/extensions/crypting/TestBCrypt.java b/Tests/ERXTest/Sources/er/extensions/crypting/TestBCrypt.java index 21fc98dd6a8..37a640f08a3 100644 --- a/Tests/ERXTest/Sources/er/extensions/crypting/TestBCrypt.java +++ b/Tests/ERXTest/Sources/er/extensions/crypting/TestBCrypt.java @@ -97,41 +97,51 @@ public static void main(String[] args) { * Test method for 'BCrypt.hashpw(String, String)' */ public void testHashpw() { + System.out.print("BCrypt.hashpw(): "); for (int i = 0; i < test_vectors.length; i++) { String plain = test_vectors[i][0]; String salt = test_vectors[i][1]; String expected = test_vectors[i][2]; String hashed = BCrypt.hashpw(plain, salt); assertEquals(hashed, expected); + System.out.print("."); } + System.out.println(""); } /** * Test method for 'BCrypt.gensalt(int)' */ public void testGensaltInt() { + System.out.print("BCrypt.gensalt(log_rounds):"); for (int i = 4; i <= 12; i++) { + System.out.print(" " + Integer.toString(i) + ":"); for (int j = 0; j < test_vectors.length; j += 4) { String plain = test_vectors[j][0]; String salt = BCrypt.gensalt(i); String hashed1 = BCrypt.hashpw(plain, salt); String hashed2 = BCrypt.hashpw(plain, hashed1); assertEquals(hashed1, hashed2); + System.out.print("."); } } + System.out.println(""); } /** * Test method for 'BCrypt.gensalt()' */ public void testGensalt() { + System.out.print("BCrypt.gensalt(): "); for (int i = 0; i < test_vectors.length; i += 4) { String plain = test_vectors[i][0]; String salt = BCrypt.gensalt(); String hashed1 = BCrypt.hashpw(plain, salt); String hashed2 = BCrypt.hashpw(plain, hashed1); assertEquals(hashed1, hashed2); + System.out.print("."); } + System.out.println(""); } /** @@ -139,11 +149,14 @@ public void testGensalt() { * expecting success */ public void testCheckpw_success() { + System.out.print("BCrypt.checkpw w/ good passwords: "); for (int i = 0; i < test_vectors.length; i++) { String plain = test_vectors[i][0]; String expected = test_vectors[i][2]; assertTrue(BCrypt.checkpw(plain, expected)); + System.out.print("."); } + System.out.println(""); } /** @@ -151,26 +164,33 @@ public void testCheckpw_success() { * expecting failure */ public void testCheckpw_failure() { + System.out.print("BCrypt.checkpw w/ bad passwords: "); for (int i = 0; i < test_vectors.length; i++) { int broken_index = (i + 4) % test_vectors.length; String plain = test_vectors[i][0]; String expected = test_vectors[broken_index][2]; assertFalse(BCrypt.checkpw(plain, expected)); + System.out.print("."); } + System.out.println(""); } /** * Test for correct hashing of non-US-ASCII passwords */ public void testInternationalChars() { - String pw1 = "ππππππππ"; + System.out.print("BCrypt.hashpw w/ international chars: "); + String pw1 = "\u2605\u2605\u2605\u2605\u2605\u2605\u2605\u2605"; String pw2 = "????????"; String h1 = BCrypt.hashpw(pw1, BCrypt.gensalt()); assertFalse(BCrypt.checkpw(pw2, h1)); + System.out.print("."); String h2 = BCrypt.hashpw(pw2, BCrypt.gensalt()); assertFalse(BCrypt.checkpw(pw1, h2)); + System.out.print("."); + System.out.println(""); } }