Compare commits

...

5 Commits

Author SHA1 Message Date
Dmitry Sovetin
e7e42922b6 Update README.md 2020-02-14 09:13:23 +03:00
Dmitry Sovetin
c0ed7ca721 Update README.md 2020-02-14 09:01:27 +03:00
Dmitry Sovetin
08129fee79 Update README.md 2019-10-31 15:57:15 +03:00
Dmitry Sovetin
fbbbef7da6 Update README.md 2019-10-31 15:54:06 +03:00
Dmitry Sovetin
bba8c620bd Corrections 2019-10-24 13:53:28 +03:00
2 changed files with 17 additions and 18 deletions

View File

@@ -1,12 +1,13 @@
# Simple multithreaded UDP server # Simple C++ multithreaded UDP server
[![Languages](https://img.shields.io/github/languages/top/SDMMSK/UDPServer.svg?style=flat-square)](README.md) [![Languages](https://img.shields.io/github/languages/top/SDMMSK/UDPServer.svg?style=flat-square)](README.md)
[![Code Size](https://img.shields.io/github/languages/code-size/SDMMSK/UDPServer.svg?style=flat-square)](README.md) [![Code Size](https://img.shields.io/github/languages/code-size/SDMMSK/UDPServer.svg?style=flat-square)](README.md)
[![License](https://img.shields.io/github/license/SDMMSK/UDPServer.svg?style=flat-square)](LICENSE) [![License](https://img.shields.io/github/license/SDMMSK/UDPServer.svg?style=flat-square)](LICENSE)
Simple multithreaded UDP server. Simple C++ multithreaded UDP server.
The number of threads is determined by the number of CPU cores. The number of threads is determined by the number of CPU cores.
JSON logging. JSON logging.
XTea encryption functions.
## Getting Started ## Getting Started

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); 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 mod = len % BLOCK_SIZE;
int offset = (len / BLOCK_SIZE) * BLOCK_SIZE; int offset = (len / BLOCK_SIZE) * BLOCK_SIZE;
char data[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); xteaDecipher(32, (uint32_t*)data, key);
} }
memcpy(inout + offset, data, mod); memcpy(inout + offset, data, mod);
cout << mod << endl;
} }
} }