Skip to content

Commit e42ac29

Browse files
committed
Replace SHA384 with MD5 for file comparison algorithm
1 parent 681d920 commit e42ac29

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Files.App/ViewModels/Properties/HashesViewModel.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public async Task<bool> CompareFileAsync()
146146

147147
if (file is not null)
148148
{
149-
var selectedFileHash = await CalculateSHA384HashAsync(file.Path);
149+
var selectedFileHash = await CalculateFileHashAsync(file.Path);
150150
var compare = CompareHash("SHA384", selectedFileHash);
151151

152152
return compare;
@@ -171,13 +171,13 @@ public string FindMatchingAlgorithm(string hash)
171171
return string.Empty;
172172
}
173173

174-
public async Task<string> CalculateSHA384HashAsync(string filePath)
174+
public async Task<string> CalculateFileHashAsync(string filePath)
175175
{
176176
using (var stream = File.OpenRead(filePath))
177177
{
178-
using (var sha384 = SHA384.Create())
178+
using (var md5 = MD5.Create())
179179
{
180-
var hash = await Task.Run(() => sha384.ComputeHash(stream));
180+
var hash = await Task.Run(() => md5.ComputeHash(stream));
181181
return BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant();
182182
}
183183
}

0 commit comments

Comments
 (0)