From 996e5e8b4ae252a22b23e3b94ccde99fc0866ad2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jul 2017 17:38:40 +0900 Subject: [PATCH] Use SHA2 for hashing --- osu-framework | 2 +- osu.Game/Beatmaps/BeatmapManager.cs | 4 ++-- osu.Game/IO/FileStore.cs | 2 +- osu.sln.DotSettings | 2 ++ 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/osu-framework b/osu-framework index 05a8b26376..5a9ca94fc3 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 05a8b2637623bd8ac6c1619b728ea9b4cca35b8a +Subproject commit 5a9ca94fc31bc796b45572eb3d0b27b46556c586 diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 4ec8be3f36..99117afe35 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -255,7 +255,7 @@ namespace osu.Game.Beatmaps using (Stream s = reader.GetStream(file)) s.CopyTo(hashable); - var hash = hashable.GetMd5Hash(); + var hash = hashable.ComputeSHA2Hash(); // check if this beatmap has already been imported and exit early if so. var beatmapSet = beatmaps.QueryAndPopulate().FirstOrDefault(b => b.Hash == hash); @@ -301,7 +301,7 @@ namespace osu.Game.Beatmaps Beatmap beatmap = decoder.Decode(sr); beatmap.BeatmapInfo.Path = name; - beatmap.BeatmapInfo.Hash = ms.GetMd5Hash(); + beatmap.BeatmapInfo.Hash = ms.ComputeSHA2Hash(); // TODO: Diff beatmap metadata with set metadata and leave it here if necessary beatmap.BeatmapInfo.Metadata = null; diff --git a/osu.Game/IO/FileStore.cs b/osu.Game/IO/FileStore.cs index 95d32785ec..e3728ab16d 100644 --- a/osu.Game/IO/FileStore.cs +++ b/osu.Game/IO/FileStore.cs @@ -44,7 +44,7 @@ namespace osu.Game.IO public FileInfo Add(Stream data, string filename = null) { - string hash = data.GetMd5Hash(); + string hash = data.GetSHA2Hash(); var info = new FileInfo { diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index f6a6e4bf9b..e3eae96ca8 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -189,7 +189,9 @@ IP IPC LTRB + MD5 RNG + SHA SRGB TK SS