Corrections

This commit is contained in:
Dmitry Sovetin
2019-10-24 13:53:28 +03:00
parent 289d0db7eb
commit bba8c620bd

View File

@@ -192,8 +192,7 @@ void stringCrypt(char *inout, int len, bool encrypt) // encrypt true - encrypt,
xteaDecipher(32, (uint32_t*)(inout + (i * BLOCK_SIZE)), key);
}
}
if (len % BLOCK_SIZE != 0)
{
if (len % BLOCK_SIZE != 0) {
int mod = len % BLOCK_SIZE;
int offset = (len / BLOCK_SIZE) * BLOCK_SIZE;
char data[BLOCK_SIZE];
@@ -205,6 +204,5 @@ void stringCrypt(char *inout, int len, bool encrypt) // encrypt true - encrypt,
xteaDecipher(32, (uint32_t*)data, key);
}
memcpy(inout + offset, data, mod);
cout << mod << endl;
}
}