#include <nitro/crypto.h>
void CRYPTO_RC4Encrypt(CRYPTORC4Context* context, const void* in, u32 length, void* out);
| context | CRYPTORC4Context structure, whose key has already been configured by the CRYPTO_RC4Init function. |
|---|---|
| in | Pointer to the target data to encrypt/decrypt with the RC4 algorithm. |
| length | Length of the data specified by in. |
| out | Pointer to where the results of the encryption/decryption are stored. |
None.
Performs encryption/decryption using the RC4 shared key encryption algorithm.
The same function is used for both encryption and decryption in the RC4 algorithm.
Data stored in in is processed, while the converted results are written to out. You can specify the same pointer for in and out, thereby overwriting them.
The CRYPTO_RC4* and CRYPTO_RC4Fast* functions are the same except that the CRYPTO_RC4Fast* functions are faster and require more stack memory. The CRYPTORC4Context structure used by the CRYPTO_RC4* functions is 260 bytes, and the CRYPTORC4FastContext structure used by the CRYPTO_RC4Fast* functions is 1032 bytes.
With regard to speed, the CRYPTO_RC4FastEncrypt function processes data at approximately 1.5 times the normal processing speed when the data is sufficiently large. However, the difference in speed is caused by assigning the same pointer for in and out. If different pointers are assigned, there is almost no speed difference between the CRYPTO_RC4Encrypt and CRYPTO_RC4FastEncrypt functions.
For detailed information on using the RC4 algorithm, see Overview of Encryption Using RC4 Algorithm.
2008/02/25 Initial version.
CONFIDENTIAL