RC4_SET_KEY(3ossl)
π RC4_SET_KEY β like, the OpenSSL version (3ossl)
okay bestie, so this page is one of those "we're legally required to tell you this exists but please don't" situations π it's the OpenSSL manual, and it's all about RC4_set_key and RC4, the good old Alleged RC4 cipher. Buckle up π
β¨ NAME β¨
RC4_set_key, RC4 β RC4 encryption, the O.G. stream cipher herself π
πΈ SYNOPSIS πΈ
#include <openssl/rc4.h>
okay so heads up first π«Ά β the following functions have been deprecated since OpenSSL 3.0, and they can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value. peep openssl_user_macros(7) for the deets β¨
void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data);
void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata,
unsigned char *outdata);
π¦ DESCRIPTION π¦
so like, all of the functions on this page are deprecated π no cap. Applications should instead use EVP_EncryptInit_ex(3), EVP_EncryptUpdate(3) and EVP_EncryptFinal_ex(3) β or the equivalently named decrypt functions, iykyk.
not me writing up a whole cipher that's been retiredβ¦ but we respect the history π«‘
This library implements the Alleged RC4 cipher, which is described for example in Applied Cryptography. It is believed to be compatible with RC4[TM], a proprietary cipher of RSA Security Inc. π
RC4 is a stream cipher with variable key length. Typically, 128 bit (16 byte) keys are used for strong encryption, but shorter insecure key sizes have been widely used due to export restrictions π (yeah, that's a whole era of internet history, don't ask π).
RC4 consists of two phases, bestie:
- a key setup phase π±
- the actual encryption or decryption phase π
RC4_set_key() sets up the RC4_KEY key using the len bytes long key at data. that's it, that's the setup β¨
RC4() encrypts or decrypts the len bytes of data at indata using key and places the result at outdata. and here's the iconic part β repeated RC4() calls with the same key yield a continuous key stream π so it just keeps flowing, bestie.
Since RC4 is a stream cipher (the input is XORed with a pseudo-random key stream to produce the output), decryption uses the same function calls as encryption π symmetric queen behavior, we love to see it π
π RETURN VALUES π
RC4_set_key() and RC4() do not return values. literally nothing. void. silent. mysterious π«₯β¨
π NOTE π
Applications should use the higher level functions EVP_EncryptInit(3) etc. instead of calling these functions directly. like, put the RC4 down and back away slowly π
ok this part is serious though: it is difficult to securely use stream ciphers. For example, do not perform multiple encryptions using the same key stream. seriously. do NOT. that's how you leak everything ππ΄
π§ SEE ALSO π§
β HISTORY β
All of these functions were deprecated in OpenSSL 3.0. π
π COPYRIGHT π
Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's the page, bestie π«Άβ¨ this was OpenSSL 3.5.6, dated 2026-04-07, filed under RC4_SET_KEY(3ossl) β go forth and use EVP_* instead, mwah ππ
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms