mirror of
https://github.com/ultrasn0w/app.git
synced 2025-12-16 11:29:52 +01:00
Register
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using APP.DTO;
|
||||
|
||||
namespace APP.Utility;
|
||||
|
||||
public static class StringAssemble
|
||||
internal static class StringAssemble
|
||||
{
|
||||
public static string UserInfo(User? user)
|
||||
private const string RegisterSecret = "綾波レイ";
|
||||
|
||||
internal static string UserInfo(User? user)
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
@@ -31,7 +34,7 @@ public static class StringAssemble
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static string UserData(User? user)
|
||||
internal static string UserData(User? user)
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
@@ -56,4 +59,20 @@ public static class StringAssemble
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
internal static string CalcSha512(string input)
|
||||
{
|
||||
var bytes = Encoding.UTF8.GetBytes(input);
|
||||
using var hash = SHA512.Create();
|
||||
var hashedInputBytes = hash.ComputeHash(bytes);
|
||||
var hashedInputStringBuilder = new StringBuilder(128);
|
||||
foreach (var b in hashedInputBytes)
|
||||
hashedInputStringBuilder.Append(b.ToString("X2"));
|
||||
return hashedInputStringBuilder.ToString().ToLower();
|
||||
}
|
||||
|
||||
internal static string CalcSauce(long malId, string username)
|
||||
{
|
||||
return CalcSha512(RegisterSecret + malId + username);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user