A modern, high-speed, easy-to-use object-oriented C++ cryptographic library, which aims to use the object-oriented features of C++ to simplify the steps of using, and make cryptographic algorithms modular, so that different cryptographic algorithms have a unified interface, thereby improving the convenience of implementation (scalability) and flexibility of use.
Algorithms are highly optimized (while ensuring readability), and several algorithms run more efficiently than classic cryptographic libraries such as OpenSSL.
- Block cipher algorithms (ECB, CBC, CFB, OFB and CTR mode) / 块密码算
法 (多 种工作 模 式 )- DES
- DES-EDE
- Blowfish
- Twofish
- Serpent
- Rijndael (AES with variable blocksize and keysize)
- Camellia
- SEED
- ARIA
- SM4
- CAST-128
- CAST-256
- IDEA
- Stream cipher algorithms /
流 密 码算法 - RC4
- ChaCha
- Salsa
- ZUC (
祖 冲之算法 )
- Hashing Algorithms (and the corresponding HMAC algorithms) / 哈希
算法 (及对应的 HMAC算法 )- CRC
- MD5
- SHA-0, SHA-1
- SHA-2 (SHA-256, SHA-224, SHA-512, SHA-384)
- SHA-3, Keccak, SHAKE-128, SHAKE-256
- BLAKE2 (BLAKE2s-256, BLAKE2s-224, BLAKE2b-512, BLAKE2b-384)
- BLAKE3 (Experimental)
- Whirlpool
- SM3
- To be continued...
git clone https://github.com/Jemtaly/CryptoXX
cd CryptoXX
make
make test
- build/cipher
Usage: build/cipher <algorithm> <mode> <key> [iv]
Supported stream ciphers:
ChaCha20, Salsa20, RC4, ZUC
Supported stream cipher modes:
Enc, Dec, Gen
Supported block ciphers:
ARIA128, Camellia128, Serpent128, Twofish128,
ARIA192, Camellia192, Serpent192, Twofish192,
ARIA256, Camellia256, Serpent256, Twofish256,
CAST128, DES, TDES2K, TDES3K, SEED, Blowfish,
CAST256, SM4, IDES, AES128, AES192, AES256
Supported block cipher modes:
ECBEnc, ECBDec, CTREnc, CTRDec, CTRGen,
CFBEnc, CFBDec, OFBEnc, OFBDec, OFBGen,
CBCEnc, CBCDec, PCBCEnc, PCBCDec
* Program will read from stdin and write to stdout.
* Key and iv should be hex strings.
build/cipher AES192 ECBEnc 0123456789abcdeffedcba98765432100123456789abcdef < in.txt > out.enc
# Encrypt in.txt in ECB mode with the AES-192 algorithm and output to out.enc.
build/cipher AES192 ECBDec 0123456789abcdeffedcba98765432100123456789abcdef < out.enc
# Decrypt out.enc and output to command line.
build/cipher RC4 Enc 0123456789abcdeffedcba9876543210 > out.enc
# Read from command line and encrypt with RC4 algorithm.
build/cipher SM4 CTRGen 0123456789abcdeffedcba9876543210 0123456789abcdeffedcba9876543210 | head -c 1024 > random.bin
# Generate 1024 random bytes with SM4-CTR mode to random.bin.
- build/hash
Usage: build/hash <algorithm> [key length] [key]
Available algorithms (Hash only):
CRC32, CRC64, BLAKE3
Available algorithms (Hash and MAC):
BLAKE2b384, BLAKE2b512, BLAKE2s256, BLAKE2s224
Available algorithms (Hash and HMAC):
SHA224, SHA256, SHA3-224, SHA3-256, SHAKE128,
SHA384, SHA512, SHA3-384, SHA3-512, SHAKE256,
SM3, MD5, SHA0, SHA1, Whirlpool
* Program will read from stdin and output to stdout.
* Key should be a hex string.
build/hash MD5 < in.txt
# Output the MD5 checksum of in.txt.
build/hash SHA3-256 3 6b6579 < in.txt
# Output the SHA3-256-HMAC of in.txt with a 3-bytes key "\x6b\x65\x79" ("key").
To be continued...