CppSecurity
C++ Security Library
Install / Use
/learn @chronoxor/CppSecurityREADME
CppSecurity
C++ Security Library provides different security functionality for password generation, password hashing algorithms and Google Authenticator.
Contents
Features
- Cross platform (Linux, MacOS, Windows)
- Password generator
- Google Authenticator support
- Password hashing algorithms (PBKDF2, bcrypt, scrypt, Argon2)
- Symmetric ciphers (AES, ARIA, Camellia)
Requirements
Optional:
How to build?
Linux: install required packages
sudo apt-get install -y binutils-dev uuid-dev libssl-dev
Install gil (git links) tool
pip3 install gil
Setup repository
git clone https://github.com/chronoxor/CppSecurity.git
cd CppSecurity
gil update
Linux
cd build
./unix.sh
MacOS
cd build
./unix.sh
Windows (Cygwin)
cd build
unix.bat
Windows (MSYS2)
cd build
unix.bat
Windows (MinGW)
cd build
mingw.bat
Windows (Visual Studio)
cd build
vs.bat
Security benchmarks
Benchmark 1: Password generator
Benchmark source file: password_generator.cpp
Benchmark report is the following:
===============================================================================
CppBenchmark report. Version 1.0.0.0
===============================================================================
CPU architecutre: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
CPU logical cores: 8
CPU physical cores: 4
CPU clock speed: 3.998 GHz
CPU Hyper-Threading: enabled
RAM total: 31.962 GiB
RAM free: 24.476 GiB
===============================================================================
OS version: Microsoft Windows 8 Enterprise Edition (build 9200), 64-bit
OS bits: 64-bit
Process bits: 64-bit
Process configuaraion: release
Local timestamp: Wed Jun 12 01:55:58 2019
UTC timestamp: Tue Jun 11 22:55:58 2019
===============================================================================
Benchmark: Generate password
Attempts: 5
Duration: 5 seconds
-------------------------------------------------------------------------------
Phase: Generate password
Average time: 73.490 mcs/op
Minimal time: 73.490 mcs/op
Maximal time: 76.286 mcs/op
Total time: 4.925 s
Total operations: 67019
Operations throughput: 13607 ops/s
===============================================================================
Benchmark: Validate password
Attempts: 5
Duration: 5 seconds
-------------------------------------------------------------------------------
Phase: Validate password
Average time: 19 ns/op
Minimal time: 19 ns/op
Maximal time: 20 ns/op
Total time: 1.944 s
Total operations: 97525818
Operations throughput: 50161060 ops/s
===============================================================================
Benchmark 2: Google Authenticator
Benchmark source file: google_authenticator.cpp
Benchmark report is the following:
===============================================================================
CppBenchmark report. Version 1.0.0.0
===============================================================================
CPU architecutre: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
CPU logical cores: 8
CPU physical cores: 4
CPU clock speed: 3.998 GHz
CPU Hyper-Threading: enabled
RAM total: 31.962 GiB
RAM free: 24.470 GiB
===============================================================================
OS version: Microsoft Windows 8 Enterprise Edition (build 9200), 64-bit
OS bits: 64-bit
Process bits: 64-bit
Process configuaraion: release
Local timestamp: Wed Jun 12 01:57:37 2019
UTC timestamp: Tue Jun 11 22:57:37 2019
===============================================================================
Benchmark: Generate Google Authenticator secret
Attempts: 5
Duration: 5 seconds
-------------------------------------------------------------------------------
Phase: Generate Google Authenticator secret
Average time: 75.167 mcs/op
Minimal time: 75.167 mcs/op
Maximal time: 77.377 mcs/op
Total time: 4.882 s
Total operations: 64960
Operations throughput: 13303 ops/s
===============================================================================
Benchmark: Generate Google Authenticator token
Attempts: 5
Duration: 5 seconds
-------------------------------------------------------------------------------
Phase: Generate Google Authenticator token
Average time: 1.244 mcs/op
Minimal time: 1.244 mcs/op
Maximal time: 1.260 mcs/op
Total time: 4.847 s
Total operations: 3894253
Operations throughput: 803368 ops/s
===============================================================================
Benchmark 3: 'PBKDF2' password hashing algorithm
Benchmark source file: password_hashing_pbkdf2.cpp
Benchmark report is the following:
===============================================================================
CppBenchmark report. Version 1.0.0.0
===============================================================================
CPU architecutre: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
CPU logical cores: 8
CPU physical cores: 4
CPU clock speed: 3.998 GHz
CPU Hyper-Threading: enabled
RAM total: 31.962 GiB
RAM free: 17.1017 GiB
===============================================================================
OS version: Microsoft Windows 8 Enterprise Edition (build 9200), 64-bit
OS bits: 64-bit
Process bits: 64-bit
Process configuaraion: release
Local timestamp: Thu Jun 6 02:52:55 2019
UTC timestamp: Wed Jun 5 23:52:55 2019
===============================================================================
Benchmark: 'PBKDF2' generate
Attempts: 5
Duration: 5 seconds
-------------------------------------------------------------------------------
Phase: 'PBKDF2' generate
Average time: 491.718 mcs/op
Minimal time: 491.718 mcs/op
Maximal time: 507.445 mcs/op
Total time: 4.933 s
Total operations: 10034
Operations throughput: 2033 ops/s
===============================================================================
Benchmark: 'PBKDF2' validate
Attempts: 5
Duration: 5 seconds
-------------------------------------------------------------------------------
Phase: 'PBKDF2' validate
Average time: 403.262 mcs/op
Minimal time: 403.262 mcs/op
Maximal time: 412.173 mcs/op
Total time: 4.976 s
Total operations: 12341
Operations throughput: 2479 ops/s
===============================================================================
Benchmark 4: 'bcrypt' password hashing algorithm
Benchmark source file: [password_hashing_bcrypt.cpp](https://
