Convert all static endpoints into a controller

This commit is contained in:
whoswhip
2025-07-09 17:01:24 -04:00
parent bea106ac72
commit b95f540ef4
6 changed files with 260 additions and 557 deletions
+16 -1
View File
@@ -1,5 +1,6 @@
using Newtonsoft.Json.Linq;
using SharpbinV2.Server.Models;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using Bcrypt = BCrypt.Net.BCrypt;
@@ -86,6 +87,20 @@ namespace SharpbinV2.Server.Services
{
return Regex.IsMatch(email, @"^[^@\s]+@[^@\s]+\.[^@\s]+$");
}
public static string SHA256Hash(string input, string salt = "")
{
using (SHA256 sha256Hash = SHA256.Create())
{
string combinedInput = input + salt;
byte[] bytes = sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(combinedInput));
StringBuilder builder = new StringBuilder();
foreach (byte b in bytes)
{
builder.Append(b.ToString("x2"));
}
return builder.ToString();
}
}
}
}