Functions
Algorithms - ARC4

Functions

WOLFSSL_API int wc_Arc4Process (Arc4 *, byte *, const byte *, word32)
 This function encrypts an input message from the buffer in, placing the ciphertext in the output buffer out, or decrypts a ciphertext from the buffer in, placing the plaintext in the output buffer out, using ARC4 encryption. This function is used for both encryption and decryption. Before this method may be called, one must first initialize the ARC4 structure using wc_Arc4SetKey. More...
 
WOLFSSL_API int wc_Arc4SetKey (Arc4 *, const byte *, word32)
 This function sets the key for a ARC4 object, initializing it for use as a cipher. It should be called before using it for encryption with wc_Arc4Process. More...
 

Detailed Description

Function Documentation

◆ wc_Arc4Process()

WOLFSSL_API int wc_Arc4Process ( Arc4 ,
byte *  ,
const byte *  ,
word32   
)

This function encrypts an input message from the buffer in, placing the ciphertext in the output buffer out, or decrypts a ciphertext from the buffer in, placing the plaintext in the output buffer out, using ARC4 encryption. This function is used for both encryption and decryption. Before this method may be called, one must first initialize the ARC4 structure using wc_Arc4SetKey.

Returns
none
Parameters
arc4pointer to the ARC4 structure used to process the message
outpointer to the output buffer in which to store the processed message
inpointer to the input buffer containing the message to process
lengthlength of the message to process

Example

Arc4 enc;
byte key[] = { key to use for encryption };
wc_Arc4SetKey(&enc, key, sizeof(key));
byte plain[] = { plain text to encode };
byte cipher[sizeof(plain)];
byte decrypted[sizeof(plain)];
// encrypt the plain into cipher
wc_Arc4Process(&enc, cipher, plain, sizeof(plain));
// decrypt the cipher
wc_Arc4Process(&enc, decrypted, cipher, sizeof(cipher));
See also
wc_Arc4SetKey

◆ wc_Arc4SetKey()

WOLFSSL_API int wc_Arc4SetKey ( Arc4 ,
const byte *  ,
word32   
)

This function sets the key for a ARC4 object, initializing it for use as a cipher. It should be called before using it for encryption with wc_Arc4Process.

Returns
none
Parameters
arc4pointer to an arc4 structure to be used for encryption
keykey with which to initialize the arc4 structure
lengthlength of the key used to initialize the arc4 structure

Example

Arc4 enc;
byte key[] = { initialize with key to use for encryption };
wc_Arc4SetKey(&enc, key, sizeof(key));
See also
wc_Arc4Process