Skip to content

Commit

Permalink
Use new MD5/SHA.HashData(Stream) overload
Browse files Browse the repository at this point in the history
  • Loading branch information
turbedi committed Feb 8, 2024
1 parent 25bfac1 commit c2c9836
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions osu.Framework/Extensions/ExtensionMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,7 @@ public static string ComputeSHA2Hash(this Stream stream)
string hash;

Check failure on line 268 in osu.Framework/Extensions/ExtensionMethods.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Join declaration and assignment in osu.Framework\Extensions\ExtensionMethods.cs on line 268

stream.Seek(0, SeekOrigin.Begin);

using (var alg = SHA256.Create())
hash = alg.ComputeHash(stream).toLowercaseHex();

hash = SHA256.HashData(stream).toLowercaseHex();
stream.Seek(0, SeekOrigin.Begin);

return hash;
Expand All @@ -289,8 +286,7 @@ public static string ComputeMD5Hash(this Stream stream)
string hash;

Check failure on line 286 in osu.Framework/Extensions/ExtensionMethods.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Join declaration and assignment in osu.Framework\Extensions\ExtensionMethods.cs on line 286

stream.Seek(0, SeekOrigin.Begin);
using (var md5 = MD5.Create())
hash = md5.ComputeHash(stream).toLowercaseHex();
hash = MD5.HashData(stream).toLowercaseHex();
stream.Seek(0, SeekOrigin.Begin);

return hash;
Expand Down

0 comments on commit c2c9836

Please sign in to comment.