Skip to content

Commit 3ea1720

Browse files
committed
Fix hashing differences between versions
1 parent c9ac0e0 commit 3ea1720

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

Data/SerbleUtils.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,14 @@ public static byte[][] ParseMda(this string str, Func<string, byte[]> parse) {
6565
return arr;
6666
}
6767

68+
// WARNING: The output of this function cannot change, otherwise passwords will break.
6869
public static string Sha256Hash(this string str) {
69-
byte[] bytes = Encoding.UTF8.GetBytes(str);
70-
byte[] hash = SHA256.HashData(bytes);
71-
return hash.Base64Encode();
70+
StringBuilder builder = new();
71+
foreach (byte t in SHA256.HashData(Encoding.UTF8.GetBytes(str))) {
72+
builder.Append(t.ToString("x2"));
73+
}
74+
75+
return builder.ToString();
7276
}
7377

7478
public static bool IsNull(this object? obj) {

0 commit comments

Comments
 (0)