From 561b68abffd404d66ccf30cb115fae361e970277 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Tue, 10 Nov 2026 08:28:25 +0000 Subject: [PATCH] Decompile fn_04423 (SHA3::Add) Batch #15668 by Yommy: 1 byte-identical, 0 confirmed by peer review. - fn_04423 SHA3::Add: byte-identical Merged automatically: every function is byte-identical to the original. --- Source/Utility/SHA3.cpp | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/Source/Utility/SHA3.cpp b/Source/Utility/SHA3.cpp index 467f2616f..acabef2ba 100644 --- a/Source/Utility/SHA3.cpp +++ b/Source/Utility/SHA3.cpp @@ -35,29 +35,34 @@ namespace { // OFFSET: 0x0061B740 // FUNCTION: fn_04423 void SHA3::Add(const unsigned char* data, unsigned int length) { - if (this->bufferedBytes != 0 && length != 0) { - while (this->bufferedBytes < this->blockSize && length != 0) { - this->buffer[this->bufferedBytes++] = *data++; + const unsigned char* current = data; + if (this->bufferedBytes > 0) { + while (length > 0 && this->bufferedBytes < this->blockSize) { + this->buffer[this->bufferedBytes++] = *current++; --length; } } + if (this->bufferedBytes == this->blockSize) { this->ProcessBlock(this->buffer); this->processedBytes += this->blockSize; this->bufferedBytes = 0; } - if (length != 0) { - while (length >= this->blockSize) { - this->ProcessBlock(data); - data += this->blockSize; - this->processedBytes += this->blockSize; - length -= this->blockSize; - } - while (length != 0) { - this->buffer[this->bufferedBytes++] = *data++; - --length; - } + if (length == 0) { + return; + } + + while (length >= this->blockSize) { + this->ProcessBlock(current); + current += this->blockSize; + this->processedBytes += this->blockSize; + length -= this->blockSize; + } + + while (length > 0) { + this->buffer[this->bufferedBytes++] = *current++; + --length; } }