diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2013-11-23 01:05:33 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2013-11-23 01:05:33 +0100 |
commit | 2f9ae0f8ac8610e13ced184847b57b87fe5db580 (patch) | |
tree | f9ad2223d518585a2cfe9ea1c73e1e37d07bf637 /sys/src/cmd/unix/drawterm/libsec/rc4.c | |
parent | ea5797c0731203c09ec5fb7172e77eab2750f1a9 (diff) |
removing (outdated) drawterm
drawterm is much better maintained by russ cox,
so removing this outdated copy.
for a more recent version, go to:
http://swtch.com/drawterm/
Diffstat (limited to 'sys/src/cmd/unix/drawterm/libsec/rc4.c')
-rw-r--r-- | sys/src/cmd/unix/drawterm/libsec/rc4.c | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/sys/src/cmd/unix/drawterm/libsec/rc4.c b/sys/src/cmd/unix/drawterm/libsec/rc4.c deleted file mode 100644 index beafa4868..000000000 --- a/sys/src/cmd/unix/drawterm/libsec/rc4.c +++ /dev/null @@ -1,104 +0,0 @@ -#include "os.h" -#include <libsec.h> - -void -setupRC4state(RC4state *key, uchar *start, int n) -{ - int t; - int index2; - uchar *state; - uchar *p, *e, *sp, *se; - - state = key->state; - se = &state[256]; - for(sp = state; sp < se; sp++) - *sp = sp - state; - - key->x = 0; - key->y = 0; - index2 = 0; - e = start + n; - p = start; - for(sp = state; sp < se; sp++) - { - t = *sp; - index2 = (*p + t + index2) & 255; - *sp = state[index2]; - state[index2] = t; - if(++p >= e) - p = start; - } -} - -void -rc4(RC4state *key, uchar *p, int len) -{ - int tx, ty; - int x, y; - uchar *state; - uchar *e; - - x = key->x; - y = key->y; - state = &key->state[0]; - for(e = p + len; p < e; p++) - { - x = (x+1)&255; - tx = state[x]; - y = (y+tx)&255; - ty = state[y]; - state[x] = ty; - state[y] = tx; - *p ^= state[(tx+ty)&255]; - } - key->x = x; - key->y = y; -} - -void -rc4skip(RC4state *key, int len) -{ - int tx, ty; - int x, y; - uchar *state; - int i; - - x = key->x; - y = key->y; - state = &key->state[0]; - for(i=0; i<len; i++) - { - x = (x+1)&255; - tx = state[x]; - y = (y+tx)&255; - ty = state[y]; - state[x] = ty; - state[y] = tx; - } - key->x = x; - key->y = y; -} - -void -rc4back(RC4state *key, int len) -{ - int tx, ty; - int x, y; - uchar *state; - int i; - - x = key->x; - y = key->y; - state = &key->state[0]; - for(i=0; i<len; i++) - { - ty = state[x]; - tx = state[y]; - state[y] = ty; - state[x] = tx; - y = (y-tx)&255; - x = (x-1)&255; - } - key->x = x; - key->y = y; -} |