Синтаксис:
Используется csharp
private string GetFileMD5(string path)
{
using (System.IO.FileStream fs = System.IO.File.OpenRead(path))
{
System.Security.Cryptography.MD5 md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] fileData = new byte[fs.Length];
fs.Read(fileData, 0, (int)fs.Length);
byte[] checkSum = md5.ComputeHash(fileData);
string result = System.BitConverter.ToString(checkSum).Replace("-", string.Empty);
return result;
}
}
{
using (System.IO.FileStream fs = System.IO.File.OpenRead(path))
{
System.Security.Cryptography.MD5 md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] fileData = new byte[fs.Length];
fs.Read(fileData, 0, (int)fs.Length);
byte[] checkSum = md5.ComputeHash(fileData);
string result = System.BitConverter.ToString(checkSum).Replace("-", string.Empty);
return result;
}
}
на андроиде проверяю хешсуммы obb и global-metadata файлов чтобы бороться со взломщиками:D
после этого Mono memory usage возрастает на 130 мб, итого ~140 мб там висит, и никогда не пропадает, и после GC.Collect() тоже. на девайсах с 1GB RAM это заканчивается крашем через несколько минут.
вопрос как очистить память?