fixed Windows tool passwort hash creation
This commit is contained in:
parent
6e764aa043
commit
c08ba046c9
@ -238,13 +238,12 @@ namespace RoleEditor
|
|||||||
u.Username = this.textBoxUserUserName.Text.Trim();
|
u.Username = this.textBoxUserUserName.Text.Trim();
|
||||||
if(this.textBoxUserPassword.Text.Trim().Length > 0 )
|
if(this.textBoxUserPassword.Text.Trim().Length > 0 )
|
||||||
{
|
{
|
||||||
var data = Encoding.UTF8.GetBytes(this.textBoxUserPassword.Text.Trim());
|
string passwortText = this.textBoxUserPassword.Text.Trim();
|
||||||
using SHA512 sha = SHA512.Create();
|
byte[] bytes = Encoding.Default.GetBytes(passwortText);
|
||||||
byte[] hashedInputBytes = sha.ComputeHash(data);
|
passwortText = Encoding.UTF8.GetString(bytes);
|
||||||
var hashedInputStringBuilder = new StringBuilder(128);
|
// Das sollte nicht verändert werden um kompatibel zu der Python Implementierung zu bleiben
|
||||||
foreach (var b in hashedInputBytes)
|
string salt = BCrypt.Net.BCrypt.GenerateSalt(12, 'b');
|
||||||
hashedInputStringBuilder.Append(b.ToString("X2"));
|
u.PasswordHash = BCrypt.Net.BCrypt.HashPassword(passwortText, salt);
|
||||||
u.PasswordHash = hashedInputStringBuilder.ToString();
|
|
||||||
}
|
}
|
||||||
u.APIKey = this.textBoxUserAPIKey.Text.Trim();
|
u.APIKey = this.textBoxUserAPIKey.Text.Trim();
|
||||||
await u.Save(_dbManager);
|
await u.Save(_dbManager);
|
||||||
|
|||||||
@ -27,6 +27,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3" />
|
||||||
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.5.0" />
|
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.5.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user