2 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
10 #include <openssl/rc4.h>
12 #include <openssl/opensslv.h>
14 const char *RC4_options(void)
16 if (sizeof(RC4_INT) == 1)
23 * RC4 as implemented from a posting from
24 * Newsgroups: sci.crypt
25 * From: sterndark@netcom.com (David Sterndark)
26 * Subject: RC4 Algorithm revealed.
27 * Message-ID: <sternCvKL4B.Hyy@netcom.com>
28 * Date: Wed, 14 Sep 1994 06:35:31 GMT
31 void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data)
34 register int id1, id2;
43 #define SK_LOOP(d,n) { \
45 id2 = (data[id1] + tmp + id2) & 0xff; \
46 if (++id1 == len) id1=0; \
50 for (i = 0; i < 256; i++)
52 for (i = 0; i < 256; i += 4) {