diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index a0e50be934109..db4e6734c848b 100644 --- a/core/java/com/android/internal/widget/LockPatternUtils.java +++ b/core/java/com/android/internal/widget/LockPatternUtils.java @@ -932,19 +932,6 @@ public class LockPatternUtils { return Long.toHexString(salt); } - /** - * Generate a hash for the given password. To avoid brute force attacks, we use a salted hash. - * Not the most secure, but it is at least a second level of protection. First level is that - * the file is in a location only readable by the system process. - * - * @param password the gesture pattern. - * - * @return the hash of the pattern in a byte array. - */ - public String legacyPasswordToHash(byte[] password, int userId) { - return LockscreenCredential.legacyPasswordToHash(password, getSalt(userId).getBytes()); - } - /** * Returns the credential type of the user, can be one of {@link #CREDENTIAL_TYPE_NONE}, * {@link #CREDENTIAL_TYPE_PATTERN}, {@link #CREDENTIAL_TYPE_PIN} and diff --git a/services/core/java/com/android/server/locksettings/LockSettingsService.java b/services/core/java/com/android/server/locksettings/LockSettingsService.java index bfa678b63d23f..59f00a2a4bc70 100644 --- a/services/core/java/com/android/server/locksettings/LockSettingsService.java +++ b/services/core/java/com/android/server/locksettings/LockSettingsService.java @@ -1773,7 +1773,7 @@ public class LockSettingsService extends ILockSettings.Stub { } else { final byte[] hashFactor = getHashFactor(password, userHandle); final byte[] salt = getSalt(userHandle).getBytes(); - String hash = password.passwordToHistoryHash(hashFactor, salt); + String hash = password.passwordToHistoryHash(salt, hashFactor); if (hash == null) { Slog.e(TAG, "Compute new style password hash failed, fallback to legacy style"); hash = password.legacyPasswordToHash(salt);