From 8a05369b5cc40f4c67cea8700fc2dd7c8487fd64 Mon Sep 17 00:00:00 2001 From: Gaein_nidb Date: Mon, 25 Nov 2024 22:07:11 +0800 Subject: [PATCH] fix: fix hash result step in foreach --- CameraCaptureBot.Core/BotHost.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CameraCaptureBot.Core/BotHost.cs b/CameraCaptureBot.Core/BotHost.cs index e0c5319..05d8945 100644 --- a/CameraCaptureBot.Core/BotHost.cs +++ b/CameraCaptureBot.Core/BotHost.cs @@ -227,11 +227,11 @@ private async Task ProcessBotOnline(BotContext bot, BotOnlineEvent _) { var hashData = MD5.HashData(Encoding.UTF8.GetBytes(pwd.Password)); var buffer = new char[hashData.Length * 2 + 1]; - for (var i = 0; i < hashData.Length; i += 2) + for (var i = 0; i < hashData.Length; i++) { var twoChar = ToCharsBuffer(hashData[i], 0x200020u); - buffer[i] = (char)(twoChar >> 16); - buffer[i + 1] = (char)(twoChar & 0x0000FFFFu); + buffer[2 * i] = (char)(twoChar >> 16); + buffer[2 * i + 1] = (char)(twoChar & 0x0000FFFFu); } buffer[^1] = '\0';