Possible bug with Bcrypt implementation on Spring : <p>I'm testing to move our password hash from sha-256 to sha-512 or bcrypt. For that, I've implemented a very simple test, but I've found out that with a specific rawPassword when Bcrypt tries to match it against the same rawPassword + anything else, it fails, returning true instead of false. Maybe it is related to the encoding, but I'm not sure.</p>

<pre class="lang-java prettyprint-override"><code>... 



    @Test
    public void testEncodePassword() {
            final String rawPassword = "¡Oh envidia, raíz de infinitos males y carcoma de las virtudes!";

            PasswordEncoder passwordEncoder = new BCryptPasswordEncoder();

            String encodedPassword = passwordEncoder.encode(rawPassword);

            assertTrue(passwordEncoder.matches(rawPassword,encodedPassword));
            assertFalse(passwordEncoder.matches("dds",encodedPassword));
            assertFalse(passwordEncoder.matches("dds"+rawPassword,encodedPassword));
            assertFalse(passwordEncoder.matches(rawPassword+"something else",encodedPassword));


    }

...
</code></pre>
