From 4a879f582c5f3f9ae42e470cca48af89d9152910 Mon Sep 17 00:00:00 2001 From: HetCreep Date: Sun, 21 Jun 2026 17:20:41 +0700 Subject: [PATCH] Hash the full UTF-8 byte length in HashStrings (#1355) HashStrings passed str.Length (a char count) as the byte count to MD5.TransformBlock, so for any non-ASCII string only a truncated prefix of the UTF-8 bytes was hashed. Capture the byte array and use its Length. --- BepInEx.Core/Utility.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/BepInEx.Core/Utility.cs b/BepInEx.Core/Utility.cs index a346ada..ed2774b 100644 --- a/BepInEx.Core/Utility.cs +++ b/BepInEx.Core/Utility.cs @@ -331,7 +331,10 @@ public static class Utility using var md5 = MD5.Create(); foreach (var str in strings) - md5.TransformBlock(Encoding.UTF8.GetBytes(str), 0, str.Length, null, 0); + { + var bytes = Encoding.UTF8.GetBytes(str); + md5.TransformBlock(bytes, 0, bytes.Length, null, 0); + } md5.TransformFinalBlock(new byte[0], 0, 0);