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();
|
||||
if(this.textBoxUserPassword.Text.Trim().Length > 0 )
|
||||
{
|
||||
var data = Encoding.UTF8.GetBytes(this.textBoxUserPassword.Text.Trim());
|
||||
using SHA512 sha = SHA512.Create();
|
||||
byte[] hashedInputBytes = sha.ComputeHash(data);
|
||||
var hashedInputStringBuilder = new StringBuilder(128);
|
||||
foreach (var b in hashedInputBytes)
|
||||
hashedInputStringBuilder.Append(b.ToString("X2"));
|
||||
u.PasswordHash = hashedInputStringBuilder.ToString();
|
||||
string passwortText = this.textBoxUserPassword.Text.Trim();
|
||||
byte[] bytes = Encoding.Default.GetBytes(passwortText);
|
||||
passwortText = Encoding.UTF8.GetString(bytes);
|
||||
// Das sollte nicht verändert werden um kompatibel zu der Python Implementierung zu bleiben
|
||||
string salt = BCrypt.Net.BCrypt.GenerateSalt(12, 'b');
|
||||
u.PasswordHash = BCrypt.Net.BCrypt.HashPassword(passwortText, salt);
|
||||
}
|
||||
u.APIKey = this.textBoxUserAPIKey.Text.Trim();
|
||||
await u.Save(_dbManager);
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3" />
|
||||
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user