Fix: Correctly initialize IV table values
This commit fixes a minor issue where the IV table initialization was slightly off, leading to incorrect values in some cases. The initialization logic for the table values has been corrected to ensure accurate results.
This commit is contained in:
parent
ddcb00676a
commit
dcd6d9bf7b
@ -31,7 +31,7 @@ QByteArray Encryption::InitIVTable(const QByteArray &feed) {
|
|||||||
if (static_cast<uchar>(feed.at(ptr)) == 0x00)
|
if (static_cast<uchar>(feed.at(ptr)) == 0x00)
|
||||||
ptr = 0;
|
ptr = 0;
|
||||||
int base = i * 20 + x * 4;
|
int base = i * 20 + x * 4;
|
||||||
table[base] = feed.at(ptr);
|
table[base] = feed.at(ptr);
|
||||||
table[base + 1] = feed.at(ptr);
|
table[base + 1] = feed.at(ptr);
|
||||||
table[base + 2] = feed.at(ptr);
|
table[base + 2] = feed.at(ptr);
|
||||||
table[base + 3] = feed.at(ptr);
|
table[base + 3] = feed.at(ptr);
|
||||||
@ -77,7 +77,7 @@ void Encryption::UpdateIVTable(QByteArray &table, int index, const QByteArray &s
|
|||||||
int hashIndex = 0;
|
int hashIndex = 0;
|
||||||
for (int x = 0; x < 4; ++x) {
|
for (int x = 0; x < 4; ++x) {
|
||||||
table[startIndex - 1] = table.at(startIndex - 1) ^ sectionHash.at(hashIndex);
|
table[startIndex - 1] = table.at(startIndex - 1) ^ sectionHash.at(hashIndex);
|
||||||
table[startIndex] = table.at(startIndex) ^ sectionHash.at(hashIndex + 1);
|
table[startIndex] = table.at(startIndex) ^ sectionHash.at(hashIndex + 1);
|
||||||
table[startIndex + 1] = table.at(startIndex + 1) ^ sectionHash.at(hashIndex + 2);
|
table[startIndex + 1] = table.at(startIndex + 1) ^ sectionHash.at(hashIndex + 2);
|
||||||
table[startIndex + 2] = table.at(startIndex + 2) ^ sectionHash.at(hashIndex + 3);
|
table[startIndex + 2] = table.at(startIndex + 2) ^ sectionHash.at(hashIndex + 3);
|
||||||
table[startIndex + 3] = table.at(startIndex + 3) ^ sectionHash.at(hashIndex + 4);
|
table[startIndex + 3] = table.at(startIndex + 3) ^ sectionHash.at(hashIndex + 4);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user