diff --git a/password/impl/src/main/java/org/wildfly/security/password/impl/UnixMD5CryptPasswordImpl.java b/password/impl/src/main/java/org/wildfly/security/password/impl/UnixMD5CryptPasswordImpl.java index 83aab671566..ad409a9e7ad 100644 --- a/password/impl/src/main/java/org/wildfly/security/password/impl/UnixMD5CryptPasswordImpl.java +++ b/password/impl/src/main/java/org/wildfly/security/password/impl/UnixMD5CryptPasswordImpl.java @@ -122,7 +122,7 @@ boolean verify(final char[] guess) throws InvalidKeyException { } catch (NoSuchAlgorithmException e) { throw log.invalidKeyCannotVerifyPassword(e); } - return Arrays.equals(getHash(), test); + return MessageDigest.isEqual(getHash(), test); } @Override @@ -238,7 +238,7 @@ public boolean equals(final Object obj) { return false; } UnixMD5CryptPasswordImpl other = (UnixMD5CryptPasswordImpl) obj; - return Arrays.equals(hash, other.hash) && Arrays.equals(salt, other.salt); + return MessageDigest.isEqual(hash, other.hash) && Arrays.equals(salt, other.salt); } private void readObject(ObjectInputStream ignored) throws NotSerializableException {