RC4 of WEP Key Stream Generator |
|
boy814072
一般會員 發表:1 回覆:0 積分:0 註冊:2006-11-08 發送簡訊給我 |
//---------------------------------------------------------------------------
#include #pragma hdrstop #include #include #include #include "RC4.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender) { //KSA int L=8,N=256,i,j,S_table[256],Key[8],tmp,out[256]; Key[0] = atoi(Edit1->Text.c_str()); Key[1] = atoi(Edit2->Text.c_str()); Key[2] = atoi(Edit3->Text.c_str()); Key[3] = atoi(Edit4->Text.c_str()); Key[4] = atoi(Edit5->Text.c_str()); Key[5] = atoi(Edit6->Text.c_str()); Key[6] = atoi(Edit7->Text.c_str()); Key[7] = atoi(Edit8->Text.c_str()); //Key[0]=23;Key[1]=89;Key[2]=142;Key[3]=2; //Key[4]=203;Key[5]=43;Key[6]=100;Key[7]=56; for(i=0;i<256;i ) S_table[i]=i; j=0; for(i=0;i j=( j S_table[i] Key[i%L] )%N; tmp=S_table[i]; S_table[i]=S_table[j]; S_table[j]=tmp; } //ShowMessage(S_table[2]); //PRNG int k,round = atoi(Edit9->Text.c_str()); i=0;j=0; for(k=0;k i=(i 1)%N; j=(j S_table[i])%N; tmp=S_table[i]; S_table[i]=S_table[j]; S_table[j]=tmp; out[i]=S_table[(S_table[i] S_table[j])%N]; Label5->Caption= out[i]; //getchar();//time(100); } //ShowMessage(S_table[0]); //ShowMessage(out[1]); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button2Click(TObject *Sender) { exit(0); } //--------------------------------------------------------------------------- 請問有那位大大可以幫忙翻譯他運算的方法~ 因為不知自已想的跟學校老師想的有沒一樣!~ |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |