# CRYPTO_RC4FastEncrypt

## Syntax

      #include <nitro/crypto.h>

      void CRYPTO_RC4FastEncrypt(CRYPTORC4FastContext* context, const void* in, u32 length, void* out);

## Arguments

context | `CRYPTORC4FastContext` structure, whose key has already been configured by the `CRYPTO_RC4FastInit` function.
in | Pointer to the target data to encrypt or decrypt with the RC4 algorithm.
length | Length of the data specified by in.
out | Pointer to where the results of the encryption or decryption are stored.

## Return Values

None.

## Description

Performs encryption or 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, and 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 size of the `CRYPTORC4Context` structure used by the `CRYPTO_RC4*` functions is 260 bytes. The size of the `CRYPTORC4FastContext` structure used by the `CRYPTO_RC4*` 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.

## See Also

`CRYPTO_RC4Fast`
`CRYPTO_RC4FastInit`

## Revision History

2008/02/25 Initial version.

CONFIDENTIAL