Register for your free account! | Forgot your password?

You last visited: Today at 14:35

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Legacy TQ Cipher - Optimized Library

Discussion on Legacy TQ Cipher - Optimized Library within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1


 
CptSky's Avatar
 
elite*gold: 0
Join Date: Jan 2008
Posts: 1,445
Received Thanks: 1,176
Legacy TQ Cipher - Optimized Library

Yeah, I know this isn't related to the latest patch, so it won't be a "cool" release for most people. For those still interested in developing pre-5018 servers, it might be interesting.

The following library implements the legacy TQ cipher. What's new / different ? It implements it natively, an expose it through a .NET interface as the DLL is coded in C++/CLI. The library includes three implementations : one using standard arithmetics, one using vectorized arithmetics with SSE and SSE2 intrinsics and finally one using vectorized arithmetics with AVX and AVX2 intrinsics. The best implementation will be selected based on your CPU. (But you can force it too)

Although it will offer improved performances, don't expect it to be significant. The encryption / decryption is not the biggest part of the server when performance is concerned.

Note. The DLL is built using Visual Studio 2013. It requires MSVC 2013 redistributables and the .NET Framework v4.0. It won't work on Windows XP, and I don't plan at the moment to do a version for it.

Performances
Months ago, I did some benchmark in C++ only. It may not represent the reality at 100% (it wasn't done much seriously, but still enough to get an idea). Plus, I had to do some changes in the code (loading / unloading blocks in registers) due to uncontrolled alignment of data from C#. Gains might be lower with my C++/CLI library.

On a Intel Core 2 Duo P8400 processor, running Mac OS X Yosemite Beta 6 and compiled using Clang 6.0 (with O3), the standard algorithm had a throughput of ~555 MB/s, the SSE/SSE2 optimized algorithm had a throughput 1600 - 3300 MB/s (as high as 40000 MB/s for a 16 bytes buffer). The AVX/AVX2 optimized algorithm should achieve even better performances, but eh, old computer.

The optimized algorithm throughput depends on the buffer size. Why ? If the buffer is a multiple of 128 bits, it will computes the result only by using SSE2. If the buffer is not a multiple of 128 bits, it will do the same O(N) algorithm (standard) for the rest of the buffer. At the end, if the buffers are never a multiple of 16 bytes, you reduce the overall throughput. If the buffer is less than 16 bytes, well, you get the plain old 555 MB/s... There is also a small overhead for the second key when it overlaps on two values (the second key value is took with the higher 8 bits of the counter, if the counter is at e.g. 245, the second key index will be 0 and later 1, which add some complexity). This overhead never really happens when having multiple of 16 bytes buffers. Anyway, in general, the optimized algorithm will be faster as you'll have several blocks of 16 bytes in the buffer.

Feel free to post better benchmarks
Attached Files
File Type: zip tqcipher_1.0.0_msvc2013.zip (1.03 MB, 285 views)
CptSky is offline  
Thanks
15 Users
Old 05/29/2015, 14:49   #2


 
KraHen's Avatar
 
elite*gold: 0
Join Date: Jul 2006
Posts: 2,216
Received Thanks: 794
Clang and CO sitting on a tree, this gets as good as it can be
KraHen is offline  
Reply

Tags
5017, avx, avx2, c#, c++/cli, cptsky, legacy, sse, sse2, tqcipher


Similar Threads Similar Threads
iPhone 5 optimized Games
04/13/2013 - Smartphones - 13 Replies
Hallo E*pvpler :) Ich suche Gamess, die für das neue iPhone 5 Display angepasst sind! Nicht irgendwelche von google, sondern welche die ihr selbst spielt :D Ich habe schon: Real Racing 3 Minecraft PE Sonic Dash 4 Worte 1 Bild Hill Climb Racing Subway Surfers
beAsty´s Script v1.0 (optimized for Light Sorc)
08/21/2012 - Diablo 2 - 137 Replies
Features: Bosses: Facts: How to install:
How to buy SILK in cSRO [OPTIMIZED]
03/02/2010 - Silkroad Online - 10 Replies
First I would like to start by saying that this guide that you can find here: http://www.elitepvpers.com/forum/foreign-sro-discus sions-questions/430857-csro-how-buy-silk-paypal.ht ml written by robert5090 is a copy, stolen from HERA. She made this guide 100% for a specific forum (I don't need to mention it) and that I have used this guide. Doing so it toked me a very long time to accomplish what I desired, the main reason was that the guide has flaws.For the experienced people it is somehow easy...
I've optimized the forum performance
09/03/2005 - Main - 3 Replies
the board should run a little bit smoother now, plz report any errors (mysql or not)
Hunterbot Optimized
06/02/2005 - World of Warcraft - 4 Replies
hi i have the optimized hunterbot it works great, but sometimes when it trys to reach the next waypoint the bot only runs in circles... after ~20 circles it reaches the wp. i have disabled the run to corpus feature because of this. on blizzhackers i have seen the solve of this problem but they are down now:( something like change 5 to 10 but i dont know where. It would be geat if somebody could help me. THX



All times are GMT +1. The time now is 14:35.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.