| 1 | /********************************************************************* |
| 2 | * Filename: arcfour.h |
| 3 | * Author: Brad Conte (brad AT bradconte.com) |
| 4 | * Copyright: |
| 5 | * Disclaimer: This code is presented "as is" without any guarantees. |
| 6 | * Details: Defines the API for the corresponding ARCFOUR implementation. |
| 7 | *********************************************************************/ |
| 8 | |
| 9 | #ifndef ARCFOUR_H |
| 10 | #define ARCFOUR_H |
| 11 | |
| 12 | /*************************** HEADER FILES ***************************/ |
| 13 | #include <stddef.h> |
| 14 | |
| 15 | /**************************** DATA TYPES ****************************/ |
| 16 | typedef unsigned char BYTE; // 8-bit byte |
| 17 | |
| 18 | /*********************** FUNCTION DECLARATIONS **********************/ |
| 19 | // Input: state - the state used to generate the keystream |
| 20 | // key - Key to use to initialize the state |
| 21 | // len - length of key in bytes (valid lenth is 1 to 256) |
| 22 | void arcfour_key_setup(BYTE state[], const BYTE key[], int len); |
| 23 | |
| 24 | // Pseudo-Random Generator Algorithm |
| 25 | // Input: state - the state used to generate the keystream |
| 26 | // out - Must be allocated to be of at least "len" length |
| 27 | // len - number of bytes to generate |
| 28 | void arcfour_generate_stream(BYTE state[], BYTE out[], size_t len); |
| 29 | |
| 30 | #endif // ARCFOUR_H |