RC4_SET_KEY(3SSL)

πŸ’– RC4_set_key, RC4 β€” RC4 encryption πŸ’–

okay bestie, so this is a page from the OpenSSL manuals, section 3SSL, filed under RC4_SET_KEY. sit down, grab a boba, because we're talking about the Alleged RC4 cipher and it's giving vintage 🫢


✨ NAME ✨

RC4_set_key, RC4 β€” RC4 encryption πŸ”


🌸 SYNOPSIS 🌸

#include <openssl/rc4.h>

okay so heads up: the following functions have been deprecated since OpenSSL 3.0, and you can hide them 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, every single function described on this page is deprecated. no cap. apps should be using EVP_EncryptInit_ex(3), EVP_EncryptUpdate(3) and EVP_EncryptFinal_ex(3) instead β€” or the equivalently named decrypt functions, whatever fits your vibe ✨

this library implements the Alleged RC4 cipher, which gets described, like, for example in Applied Cryptography. it's 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 because of export restrictions. the way that history nerfed our crypto 😭

RC4 is made of two phases: a key setup phase and the actual encryption or decryption phase.

  • RC4_set_key() β€” sets up the RC4_KEY key using the len bytes long key at data πŸŽ€
  • RC4() β€” encrypts or decrypts the len bytes of data at indata using key, then places the result at outdata. repeated RC4() calls with the same key yield a continuous key stream ⭐

and because 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. one function, both directions, main character energy fr fr πŸ’…


πŸ’œ RETURN VALUES πŸ’œ

RC4_set_key() and RC4() do not return values. nothing. silence. zero. the void 🌈


πŸŽ€ NOTE πŸŽ€

apps should use the higher level functions like EVP_EncryptInit(3) etc. instead of calling these functions directly, bestie. i'm serious.

⚠️ It is difficult to securely use stream ciphers. for example, do not perform multiple encryptions using the same key stream. that's a real warning, not a vibe check πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘

EVP_EncryptInit(3)


🌸 HISTORY 🌸

all of these functions were deprecated in OpenSSL 3.0. iconic of them to age out, honestly 🧚


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 whole page, bestie!! this was OpenSSL 4.0.3, dated 2026-09-29, filed in section 3SSL under RC4_SET_KEY. deprecated but still iconic, lowkey nostalgic, highkey don't use it in prod πŸ’…βœ¨πŸŒΈ

πŸ“¦ where this page comes from