void StandardInMessage::doChecksum()
{
	auto givenChecksum = getU32();
	auto size = getRemainingSize();

	if(givenChecksum != crypto::adler32(peekRawChunckAs<uint8_t>(size), size))
		throw PacketException();
}
void StandardInMessage::xteaDecrypt(const crypto::Xtea& xtea)
{
	auto size = getRemainingSize();

	if(size%8 != 0)
		throw PacketException();

	xtea.decrypt(peekRawChunckAs<uint32_t>(size), size);

	setRemainingSize(getU16());
}
Exemple #3
0
bool DataBuffer::Append( char* _pBuffer, unsigned int _uSize )
{
	if(getRemainingSize() < _uSize)
		return false;

	//Copy the data :
	CopyMemory(pBuffer+uSize,_pBuffer,_uSize);

	//Update the size of the buffer.
	uSize+=_uSize;

	return true;
}