Stream ciphers implement the SymmetricCipher interface, which is documented at http://www.cryptopp.com/docs/ref/struct_symmetric_cipher_documentation.html. The following example uses the Sosemanuk stream cipher:
byte plaintext[100], ciphertext[100], key[Sosemanuk::DEFAULT_KEYLENGTH], iv[Sosemanuk::IV_LENGTH];
// put data into key, iv, and plaintext here
// encrypt
Sosemanuk::Encryption enc(key, Sosemanuk::DEFAULT_KEYLENGTH, iv);
enc.ProcessData(ciphertext, plaintext, 100);
// now decrypt
Sosemanuk::Decryption dec(key, Sosemanuk::DEFAULT_KEYLENGTH, iv);
dec.ProcessData(plaintext, ciphertext, 100);
2007-Aug-16 5:11pm weidai |