### Question:
BCrypt { public static boolean checkpw (@Nonnull final String sPlaintext, @Nonnull final String sHashed) { final String sNewHashed = hashpw (sPlaintext, sHashed); final byte [] aHashedBytes = sHashed.getBytes (StandardCharsets.UTF_8); final byte [] aTryBytes = sNewHashed.getBytes (StandardCharsets.UTF_8); if (aHashedBytes.length != aTryBytes.length) return false; byte ret = 0; for (int i = 0; i < aTryBytes.length; i++) ret |= aHashedBytes[i] ^ aTryBytes[i]; return ret == 0; }  @Nonnull byte [] crypt_raw(final byte [] password, final byte [] salt, final int nLogRounds, final int [] cdata); @Nonnull static String hashpw(@Nonnull final String sPassword, @Nonnull final String sSalt); @Nonnull static String gensalt(@Nonnegative final int nLogRounds, @Nonnull final SecureRandom aRandom); @Nonnull static String gensalt(@Nonnegative final int log_rounds); @Nonnull static String gensalt(); static boolean checkpw(@Nonnull final String sPlaintext, @Nonnull final String sHashed); static final int GENSALT_DEFAULT_LOG2_ROUNDS; static final int BCRYPT_SALT_LEN; }### Answer:
@Test public void testCheckpw_success () { LOGGER.info ("BCrypt.checkpw w/ good passwords: "); for (final String [] test_vector : test_vectors) { final String plain = test_vector[0]; final String expected = test_vector[2]; assertTrue (BCrypt.checkpw (plain, expected)); LOGGER.info ("."); } LOGGER.info (""); }
@Test public void testCheckpw_failure () { LOGGER.info ("BCrypt.checkpw w/ bad passwords: "); for (int i = 0; i < test_vectors.length; i++) { final int broken_index = (i + 4) % test_vectors.length; final String plain = test_vectors[i][0]; final String expected = test_vectors[broken_index][2]; assertFalse (BCrypt.checkpw (plain, expected)); LOGGER.info ("."); } LOGGER.info (""); }