From 56e144e8ab48176ae71665c7e58ac2c617bfa281 Mon Sep 17 00:00:00 2001 From: limited_dev Date: Thu, 8 Jun 2023 23:31:17 +0200 Subject: [PATCH] feat: added getmd5hash func into TheManager Signed-off-by: limited_dev --- ImageBoardServerApp/Util/TheManager.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ImageBoardServerApp/Util/TheManager.cs b/ImageBoardServerApp/Util/TheManager.cs index 1e43657..1bbcbf9 100644 --- a/ImageBoardServerApp/Util/TheManager.cs +++ b/ImageBoardServerApp/Util/TheManager.cs @@ -1,3 +1,4 @@ +using System.Security.Cryptography; using ImageBoardServerApp.Data; using ImageBoardServerApp.Data.Repository; @@ -93,4 +94,15 @@ public class TheManager { return await CommentsRepository.getCommentByGETAsync(board, GET) != null; } + + public static string getmd5Hash() + { + var bytes = new byte[16]; + using (var rng = new RNGCryptoServiceProvider()) + { + rng.GetBytes(bytes); + } + + return BitConverter.ToString(bytes).Replace("-", "").ToLower(); + } } \ No newline at end of file