summaryrefslogtreecommitdiff
path: root/Services/UserService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Services/UserService.cs')
-rw-r--r--Services/UserService.cs13
1 files changed, 12 insertions, 1 deletions
diff --git a/Services/UserService.cs b/Services/UserService.cs
index d2abea3..c333c4f 100644
--- a/Services/UserService.cs
+++ b/Services/UserService.cs
@@ -1,4 +1,6 @@
-namespace HyperBooru.Services;
+using Microsoft.AspNetCore.Cryptography.KeyDerivation;
+
+namespace HyperBooru.Services;
public interface IUserService {
public bool ShowNsfw { get; set; }
@@ -18,4 +20,13 @@ public class UserService : IUserService {
public event EventHandler<bool> ShowNsfwChanged;
private bool showNsfw = false;
+
+ public static string HashPassword(string password) =>
+ Convert.ToBase64String(
+ KeyDerivation.Pbkdf2(
+ password,
+ Array.Empty<byte>(),
+ KeyDerivationPrf.HMACSHA512,
+ 100_000,
+ 512 / 8));
}