forked from ppy/osu-stream
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHasher.cs
More file actions
44 lines (36 loc) · 1.1 KB
/
Hasher.cs
File metadata and controls
44 lines (36 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using Microsoft.VisualBasic;
using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
namespace StreamFormatDecryptor
{
public class Hasher{
public static string CreateMD5(string input)
{
// Use input string to calculate MD5 hash
using (System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create())
{
byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
byte[] hashBytes = md5.ComputeHash(inputBytes);
return BitConverter.ToString(hashBytes);
}
}
public string AESDecryptKey(string ArtistName, string BeatmapSetID, string Mapper, string SongTitle, bool is_osz2){
string KeyAlg = "";
switch (is_osz2)
{
case true:
KeyAlg = (char)0x08 + Mapper + "yhxyfjo5" + BeatmapSetID;
break;
case false:
KeyAlg = (char)0x08 + SongTitle + "4390gn8931i" + ArtistName;
break;
}
string Key = Convert.ToString(CreateMD5(KeyAlg))!;
return Key;
}
}
}