// http://en.wikipedia.org/wiki/RC4#Test_vectors // gcc tvh.c x.c #include #include typedef unsigned char ch; typedef struct {ch s[256]; ch i; ch j;} state; void mv(ch *, state *, int); void initst(state *, ch *); typedef struct {ch * key; ch * pt;} tv; tv t[] = {{(ch*)"Key", (ch*)"Plaintext"}, // BBF316E8D940AF0AD3 {(ch*)"Wiki", (ch*)"pedia"}, // 1021BF0420 {(ch*)"Secret", (ch*)"Attack at dawn"}}; // 45A01F645FC35B383552544B9BF5 ch ans[100]; state s; int main(){ {int q; for(q=0; q