Ordo
0.3.4
Symmetric Cryptography Library
|
Primitive. More...
#include "ordo/primitives/stream_ciphers.h"
Go to the source code of this file.
Functions | |
ORDO_PUBLIC int | rc4_init (struct RC4_STATE *state, const void *key, size_t key_len, const struct RC4_PARAMS *params) |
ORDO_PUBLIC void | rc4_update (struct RC4_STATE *state, void *buffer, size_t len) |
ORDO_PUBLIC void | rc4_final (struct RC4_STATE *state) |
ORDO_PUBLIC size_t | rc4_query (int query, size_t value) |
ORDO_PUBLIC size_t | rc4_bsize (void) |
Primitive.
RC4 is a stream cipher, which accepts keys between 40 and 2048 bits (in multiples of 8 bits only). It accepts a parameter consisting of the number of initial keystream bytes to drop immediately after key schedule, effectively implementing RC4-drop[n]. If no drop parameter is passed, the implementation drops 2048 bytes by default.
Be aware that even with a drop, it isn't secure to encrypt more than a few hundred megabytes of data with the same key (due to a distinguisher attack that can distinguish between an RC4 keystream and a random stream). If you are concerned, use a different algorithm or rekey at generous intervals.
ORDO_PUBLIC int rc4_init | ( | struct RC4_STATE * | state, |
const void * | key, | ||
size_t | key_len, | ||
const struct RC4_PARAMS * | params | ||
) |
stream_init()
ORDO_KEY_LEN | if the key length was less than 40 bits (5 bytes) or more than 2048 bits (256 bytes). |
params
argument, see RC4_PARAMS
. By default, 2048 bytes are dropped. ORDO_PUBLIC void rc4_update | ( | struct RC4_STATE * | state, |
void * | buffer, | ||
size_t | len | ||
) |
stream_update()
ORDO_PUBLIC void rc4_final | ( | struct RC4_STATE * | state | ) |
stream_final()
ORDO_PUBLIC size_t rc4_query | ( | int | query, |
size_t | value | ||
) |
stream_query()
ORDO_PUBLIC size_t rc4_bsize | ( | void | ) |
Gets the size in bytes of an RC4_STATE
.