MyCodecUtils { public static boolean isPasswordDjangoMatches(String clearPassword, String encodedPassword) { String[] parts = encodedPassword.split("\\$"); if (parts.length != 4) { return false; } String algorithmName = parts[0]; if (!algorithmName.equals(DJANGO_HASH_ALGORITHM_NAME)) { return false; } int iterations = Integer.parseInt(parts[1]); String salt = parts[2]; String storedHash = parts[3]; String hashUsingStoredSetup = hashLikeDjango(clearPassword, salt, iterations); return storedHash.equals(hashUsingStoredSetup); }  static String encodePasswordLikeDjango(String clearPassword); static boolean isPasswordDjangoMatches(String clearPassword, String encodedPassword); static final String DJANGO_HASH_ALGORITHM_NAME; }
@Test public void testIsPasswordDjangoMatches() throws Exception { assertTrue(MyCodecUtils.isPasswordDjangoMatches("dhde8212", "pbkdf2_sha256$10548$qZFRFfsx7E$GJtb+sRQipEJnu+ORrwZe8xQE1SQV4pXijFnVl0G5CI=")); assertTrue(MyCodecUtils.isPasswordDjangoMatches("Hello@Beckham", "pbkdf2_sha256$10191$ZXQ1yh5fWD$K0PXJG3Ro8aG4Vu6sgszszrRssngLVicyLI/ax0hQtA=")); }