Stream Cipher
Jump to navigation
Jump to search
A Stream Cipher is a symmetric key algorithm where plain text bytes are combined with a pseudorandom cipher byte stream or key stream.
Crypto++ includes the following stream ciphers:
- XChaCha20Poly1305
- ChaCha20Poly1305
- XChaCha20
- XChaCha20
- ChaChaTLS
- ChaCha20
- Salsa20
- Sosemanuk
- Panama
- HC-256
- HC-128
- Rabbit
- ARC4
- SEAL
- WAKE
- WAKE-OFB
- BlumBlumShub
Remarks
The same routine is used in either direction --encryption or decryption.
Examples
unsigned char* inOut; unsigned int inOutSize; unsigned char* key; unsigned int keySize; ARC4 rc4(key, keySize); rc4.ProcessString(inOut, inOutSize);
To encrypt and decrypt with the same object, then you will have to rekey the object:
ARC4 rc4(key, keySize); // Encrypt rc4.ProcessString(inOut, inOutSize); // Reset state arc4.SetKey(key, keySize); // Decrypt rc4.ProcessString(inOut, inOutSize);