diff --git a/src/neo/Wallets/SQLite/UserWallet.cs b/src/neo/Wallets/SQLite/UserWallet.cs index 36b865a2e3..1764db5299 100644 --- a/src/neo/Wallets/SQLite/UserWallet.cs +++ b/src/neo/Wallets/SQLite/UserWallet.cs @@ -174,7 +174,7 @@ public bool ChangePassword(string password_old, string password_new) byte[] passwordKey = password_new.ToAesKey(); try { - SaveStoredData("PasswordHash", passwordKey.Sha256()); + SaveStoredData("PasswordHash", passwordKey.Concat(salt).ToArray().Sha256()); SaveStoredData("MasterKey", masterKey.AesEncrypt(passwordKey, iv)); return true; } diff --git a/tests/neo.UnitTests/Wallets/SQLite/UT_UserWallet.cs b/tests/neo.UnitTests/Wallets/SQLite/UT_UserWallet.cs index 87993f12cd..fc7f9702d2 100644 --- a/tests/neo.UnitTests/Wallets/SQLite/UT_UserWallet.cs +++ b/tests/neo.UnitTests/Wallets/SQLite/UT_UserWallet.cs @@ -167,6 +167,7 @@ public void TestChangePassword() { wallet.ChangePassword("123455", "654321").Should().BeFalse(); wallet.ChangePassword("123456", "654321").Should().BeTrue(); + wallet.ChangePassword("654321", "123456").Should().BeTrue(); } [TestMethod]