From 3f4c0720e1e3421431e7baa20882a4a4512a7fab Mon Sep 17 00:00:00 2001 From: ivar Date: Sun, 19 Oct 2025 23:41:23 +0200 Subject: Initial --- src/Utilities/PasswordHasher.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/Utilities/PasswordHasher.cs (limited to 'src/Utilities/PasswordHasher.cs') diff --git a/src/Utilities/PasswordHasher.cs b/src/Utilities/PasswordHasher.cs new file mode 100644 index 0000000..213e03d --- /dev/null +++ b/src/Utilities/PasswordHasher.cs @@ -0,0 +1,18 @@ +using IOL.Fagprove.Data.Models; +using Microsoft.AspNetCore.Identity; + +namespace IOL.Fagprove.Utilities +{ + public static class PasswordHasher + { + public static string HashPassword(string password) { + var hasher = new PasswordHasher(); + return hasher.HashPassword(null, password); + } + + public static bool PasswordMatches(string hash, string password) { + var hasher = new PasswordHasher(); + return hasher.VerifyHashedPassword(null, hash, password) == PasswordVerificationResult.Success; + } + } +} \ No newline at end of file -- cgit v1.3