diff --git a/anbs_cp/Classes/FileHash.cs b/anbs_cp/Classes/FileHash.cs
index b1453be..73ca448 100644
--- a/anbs_cp/Classes/FileHash.cs
+++ b/anbs_cp/Classes/FileHash.cs
@@ -1,4 +1,5 @@
using System.Security.Cryptography;
+using System.Text;
using Microsoft.AspNetCore.Http;
@@ -7,7 +8,7 @@ namespace anbs_cp.Classes;
///
/// Класс для работы с хэшем файла
///
-public class FileHash
+public sealed class FileHash
{
///
/// Получение md5-хэша файла.
@@ -35,14 +36,32 @@ public class FileHash
Hash = md5.ComputeHash(streamReader.BaseStream);
}
+ ///
+ /// Простой конструктор
+ ///
+ public FileHash ()
+ {
+ Hash = new byte[] { };
+ }
+
///
/// Хэш файла
///
- public byte[] Hash { get; }
+ public byte[] Hash { get; private set; }
///
/// Вывод в строку
///
/// Строка хэша файла
public override string ToString () => BitConverter.ToString(Hash).Replace("-", "").ToLowerInvariant();
+
+ ///
+ /// Конвертирует строку в хэш
+ ///
+ /// Строка
+ public void FromString (string value)
+ {
+ UTF8Encoding utf8 = new();
+ Hash = utf8.GetBytes(value);
+ }
}
\ No newline at end of file
diff --git a/anbs_cp/anbs_cp.csproj b/anbs_cp/anbs_cp.csproj
index bdbb49c..2003061 100644
--- a/anbs_cp/anbs_cp.csproj
+++ b/anbs_cp/anbs_cp.csproj
@@ -2,7 +2,7 @@
net7.0
- 2023.204.0
+ 2023.211.0
Alexander Babaev
ANB Software Components Pack
Library of some useful functions in C# language.