private void OnEncrypt(BufferData data, ref int length) { var paddingCount = (byte)(8 - length % 8); var tempArray = BufferManager.RequestBuffer(); tempArray[0] = paddingCount; BufferData.Copy(data, data.Offset, tempArray, paddingCount, length); length += paddingCount; GameCryptManager.Encrypt(tempArray.Buffer, tempArray.BaseOffset, ref length, length, Data); BufferData.Copy(tempArray, 0, data, data.Offset, length); BufferManager.FreeBuffer(tempArray); }