Background and development
The TwoFish encryption was developed in 1998 by Bruce Schneier and it is perfectly royalty free, uncopyrighted open source, and still this encryption is stronger.
And I needed plan to use this hard-to-break encryption for maximum performance on USB3.2 Gen1 (USB3.0) 5Gbps some heading packets in real-time as protect from analysis by hijacking with inspecting tool like WireShark.
Most of popular encrypting algorithms, and one of among them, AES-256 maybe the best option but very slow on non-hardware instrcution supports. Maybe BlowFish is much faster and still strong but Bruce Schneier made TwoFish in years later for AES standard.
In 1998 to 2000, most of powerful CPU must be intel x86 architecture, so BlowFish and TwoFish fully optimized x86 32bit architecture, and SIMD for Intel. But these technologies are not suitable to 21 centuries, most of CPUs are running on 64bit architecture from smartphones to PC.
So, I made it for run on most of modern 64bit architectures from ARM Cortex to x86.64. And it made for open source and should be clone here.
Developing and optimizing
First time to (non optimized) running performance was poor at Apple MacBook Air (M1). AES-256-ECB totally poor performance within 10MB/sec. BlowFish and TwoFish(ECB) up to 60 and 70MB/sec.
Then tested performance again with “-Os” option on every static library in level of code generation. AES-256-ECB extreamly performance increased 64MB/sec. from 9MB/sec. (711%) on Apple M1. BlowFish increased 340% and TwoFish increased 288%.
Also performance tested on Windows + Intel i7-7700 (3.6GHz) for this,
Intel i7 7th generation was not a comparison, just half performance of Apple M1, but it is still my developing PC on office.
Plus, a special test for ARM Cortex-A72, Rockchip RK3399 performance is here. (debian-linux aarch64, kernel v4.14, performance released, governor=on-demand)
Exceptionally RK3399 uses only for Cortex-A72 (big cores, 2x) for doing encryption, and it result recorded as bad performance than any platforms even it was not as expected.
Apple MacBook Pro ratina 13″ 2015 (Intel i7-5557U 3.1GHz) performance here. Little bit slower than i7-7700 (3.6GHz) and looks not bad performance than i7-7700 Windows10 PC, AES-256-ECB is faster, a strange result or maybe Windows10 performance issue – My experience always telling me to Windows 10 might be not the best OS.
BlowFish may a fastest encrypting method until 21 centuries even it not mighty than AES-256 even TwoFish. And TwoFish must be a good choice to dealing performance and security.