mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
increase speed of mysql when searching posts
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,6 +59,8 @@ public class Startup
|
||||
services.AddScoped<IOptionProvider, DbOptionProvider>();
|
||||
services.AddHttpClient();
|
||||
|
||||
services.AddSingleton<Hash>();
|
||||
|
||||
// Trigger module handlers.
|
||||
_core.Modules.ConfigureServices(services);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user