• finall[i]=fmal[j]; finall[i]='\0';
• retum(final);
• }
• int main()
• {
• D esdl,d2;
• char * str=new char[ 1000];
• char * str 1 =new char[ 1000];
• //strcpy(str,"PHOENIX it & ece solutions.");
• co u t« "E n ter a string :
• gets(str);
• strl=dl.Encrypt(str);
• c o u t« "\n i/p Text: "< < str«endl;
• c o u t« " \n C y p h e r: "< < strl« e n d l;
• // ofstream fout("out2_fil.txt"); f o u t « s t r l ; fout.close()
• co u t« "\n o /p Text: "<• return 0;
• }
• // Kalit generatsiyasi jarayoni
• void Des::keygen()
• {
• PermChoicelO;
• int ij,k =0;
• for(i=0;i<28;i++)
• {
• ck[i]=pcl[i];
2 7 7
• }
• for(i=28;i<56;i++)
• {
• dk[k]=pcl[i];
• k++;
• }
• int noshift=0, round;
• for(round= 1 ;round<= 16 ;round++)
• {
• if(round== 1 ||round=21 |round==9] |round== 16)
• noshift=l;
• else
• noshift=2;
• while(noshift>0)
• {
• intt;
• t=ck[0];
• for(i=0;i<28;i++)
• ck[i]=ck[i+l];
• ck[27]=t;
• t=dk[0];
• for(i=0;i<28;i++)
• dk[i]=dk[i+l];
• dk[27]=t;
• noshift—;
• }
• PermChoice2();
• for(i=0;i<48;i++)
• keyi[round-l][i]=z[i];
• }
• }
2 7 8
P arolli au tentifikatsiyalash algoritm in ing dastu riy am alga
oshirilishi.
Oddiy autentifikatsiyani tashkil etish sxemalari nafaqat parol-
lami uzatish, balki ulami saqlash va tekshirish turlari bilan ajralib
turadi. Eng keng tarqalgan usul - foydalanuvchilar parolini tizimli
fayllarda ochiq holda saqlash usulidir. Bunda fayllarga o‘qish va yo-
zishdan himoyalash atributlari o‘matiladi (masalan, operatsion ti-
zimdan foydalanishni nazoratlash ro‘yxatidagi mos imtiyozlami tav-
siflash yordamida). Tizim foydalanuvchi kiritgan parolni parollar
faylida saqlanayotgan yozuv bilan solishtiradi. Bu usulda shifrlash
yoki bir tomonlama funksiyalar kabi kriptografik mexanizmlar ish-
latilmaydi. Ushbu usulning kamchiligi - niyati buzuq odamning ti-
zimda ma’mur imtiyozlaridan, shu bilan birga tizim fayllaridan,
jumladan, parol fayllaridan foydalanish imkoniyatidir.
Autentifikatsiyalash algoritmining dasturiy kodi(S++ dastur-
lash tilida).
Foydalanuvchini autentifikatsiyadan o ‘tkazish fimksiyasi:
void Auth()
{
cout«"Authentification process";
ifstream PassfileCpassword.txt", ios::in);
Passfile»inpass;
ifstream Userfile("usemame.txt", ios::in);
U serfile»inuser;
system("cls");
cout«"USERN A M E:
c in » u se r;
c o u t« " PAS SWORD:
c in » p a ss;
Userfile.close();
Passfile.close();
if(user==inuser&&pass==inpass)
{
2 7 9
c o u t« "\n H it enter to continue to members area";
getch();
//Nimadir sh qisin
mainQ;
}
else
{
cou t« "n o p e";
getch();
main();
}
}
Foydalanuvchini ro‘yxatdan o ‘tkazish funksiyasi:
void Registration()
{
string tempuser, temppassword;
co u t« "E n te r Username:
cin»tem puser;
co u t« "\n E n ter password:
cin»tem ppassw ord;
ofstream Userfile("usemame.txt", ios::out);
U serfile«tem puser;
Userfile.close();
ofstream Passfile("password.txt", ios::out);
Passfile«tem ppassword;
Passfile.close();
cout«"A ccount hass been added";
getch();
main();
2 8 0
|