Use SHA2 for hashing

This commit is contained in:
Dean Herbert 2017-07-27 17:38:40 +09:00
parent 5f53426a9a
commit 996e5e8b4a
4 changed files with 6 additions and 4 deletions

@ -1 +1 @@
Subproject commit 05a8b2637623bd8ac6c1619b728ea9b4cca35b8a
Subproject commit 5a9ca94fc31bc796b45572eb3d0b27b46556c586

View File

@ -255,7 +255,7 @@ private BeatmapSetInfo importToStorage(ArchiveReader reader)
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<BeatmapSetInfo>().FirstOrDefault(b => b.Hash == hash);
@ -301,7 +301,7 @@ private BeatmapSetInfo importToStorage(ArchiveReader reader)
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;

View File

@ -44,7 +44,7 @@ protected override void Prepare(bool reset = false)
public FileInfo Add(Stream data, string filename = null)
{
string hash = data.GetMd5Hash();
string hash = data.GetSHA2Hash();
var info = new FileInfo
{

View File

@ -189,7 +189,9 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IP/@EntryIndexedValue">IP</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IPC/@EntryIndexedValue">IPC</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LTRB/@EntryIndexedValue">LTRB</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MD/@EntryIndexedValue">MD5</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RNG/@EntryIndexedValue">RNG</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SHA/@EntryIndexedValue">SHA</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SRGB/@EntryIndexedValue">SRGB</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=TK/@EntryIndexedValue">TK</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SS/@EntryIndexedValue">SS</s:String>