increase speed of mysql when searching posts

This commit is contained in:
2024-02-18 18:50:01 +03:00
parent 24977c90bd
commit 2ae2d92e26
5 changed files with 42 additions and 4 deletions
+21
View File
@@ -0,0 +1,21 @@
using System.Security.Cryptography;
using System.Text;
namespace Kruzya.TelegramBot.Core.Service
{
public class Hash
{
public string GenerateHash(string input)
{
var output = string.Empty;
var hashedBytes = SHA256.HashData(Encoding.UTF8.GetBytes(input));
foreach (var b in hashedBytes)
{
output += string.Format("{0,2:x2}", b);
}
return output;
}
}
}
+2
View File
@@ -59,6 +59,8 @@ public class Startup
services.AddScoped<IOptionProvider, DbOptionProvider>();
services.AddHttpClient();
services.AddSingleton<Hash>();
// Trigger module handlers.
_core.Modules.ConfigureServices(services);
}