Skip to content

Commit 6eba2ee

Browse files
authored
Fix change password (#1490)
1 parent d71a470 commit 6eba2ee

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/neo/Wallets/SQLite/UserWallet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public bool ChangePassword(string password_old, string password_new)
174174
byte[] passwordKey = password_new.ToAesKey();
175175
try
176176
{
177-
SaveStoredData("PasswordHash", passwordKey.Sha256());
177+
SaveStoredData("PasswordHash", passwordKey.Concat(salt).ToArray().Sha256());
178178
SaveStoredData("MasterKey", masterKey.AesEncrypt(passwordKey, iv));
179179
return true;
180180
}

tests/neo.UnitTests/Wallets/SQLite/UT_UserWallet.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ public void TestChangePassword()
167167
{
168168
wallet.ChangePassword("123455", "654321").Should().BeFalse();
169169
wallet.ChangePassword("123456", "654321").Should().BeTrue();
170+
wallet.ChangePassword("654321", "123456").Should().BeTrue();
170171
}
171172

172173
[TestMethod]

0 commit comments

Comments
 (0)