[rcore] Fix ComputeSHA256() wrong hash when message length mod 64 is 56..59 (#6144)

This commit is contained in:
Quaylyn Rimer
2026-09-12 02:24:51 -06:00
committed by GitHub
parent 2f768eb670
commit 98c175e692

View File

@@ -3535,7 +3535,7 @@ unsigned int *ComputeSHA256(const unsigned char *data, int dataSize)
hash[7] = 0x5be0cd19;
const unsigned long long bitLen = 8ULL*dataSize;
unsigned long long paddedSize = dataSize + sizeof(dataSize);
unsigned long long paddedSize = dataSize + sizeof(bitLen); // Reserve room for the 64 bit message length appended at the end
paddedSize += (64 - (paddedSize%64));
unsigned char *buffer = (unsigned char *)RL_CALLOC(paddedSize, sizeof(unsigned char));