: -  : -
: -   
 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 




: -

. . .

-

: 112.

. .

. 2001

堠 3

3

񠠠 3

蠠 4

, . Internet. , , () . . , cgi- , . , . . , , , , . .

. A X. :

h: A {0, x-1}

. . h A X.

: A {a, b, c, } X {0, 1, 2, }, h:AX A B. h(a)=0, h(c)=2 . .

, , (. . h(a)=0, , g: XA, g(0)=a). , A x1. , A (x1, x2) , . X A. -.

- . , -.

-, . : XY , (x) X, Y x, (x)=y, . , , , .

kript :

;

;

.

1.

:

;

;

( ).

2.

, (, ). , , .

.

3.

( 8 , , , - ( )). , - .

, . , , :

1. .

2. 5 1 , 8 ( , , . .). , .

3. , ASCII :

If j*generate(x,n,j) = < > then write(ord(j)), j , x - , n - ( [1, 8]). , .

, , .

generate=trunc(k*(abs(sin(ln(a)*x)+ sin(cos(b)*x)))):

1. (x);

2. (a);

3. (b).

, 0 2*k, k - . k - .

add_in_list(x: integer; s: string; var gr: llist) - l^.inf:=ord(s[k])*generate(x,ord(s[k]),k), l^.inf- , x - ( generate), s - , 8 . 8 5 .

summ_all(gr: llist; var a:array_type) l 8 a, .. , .. a[1].

- .

a, FromIntToString(), .

.

:

kriptmod.pas

unit kriptmod;

interface

type Plist=^list;

list=record

inf: word;

num: 1..8;

next: Plist;

end;

Llist=^List_of_list;

List_of_list=record

nb: Plist;

inf: 1..32;

next: Llist;

end;

array_type=array[1..8] of longint;

function generate(x: integer; a, b: byte):integer;

procedure add_in_llist(x: integer; s: string; var gr: llist);

procedure print_llist(gr: llist);

procedure summ_all(gr: llist; var a:array_type);

function FromIntToString(L: longint):string;

implementation

{-- ----------------------------------------------}

function FromIntToString;

var s: string;

l1: longint;

begin

l1:=l; s:='';

while (l1 div 10>0) do

begin

case l1 mod 10 of

0: s:=s+'0';

1: s:=s+'1';

2: s:=s+'2';

3: s:=s+'3';

4: s:=s+'4';

5: s:=s+'5';

6: s:=s+'6';

7: s:=s+'7';

8: s:=s+'8';

9: s:=s+'9';

end;

l1:=l1 div 10;

end;

case l1 mod 10 of

0: s:=s+'0';

1: s:=s+'1';

2: s:=s+'2';

3: s:=s+'3';

4: s:=s+'4';

5: s:=s+'5';

6: s:=s+'6';

7: s:=s+'7';

8: s:=s+'8';

9: s:=s+'9';

end;

FromIntToString:=s;

end;

{-- ()----------------------------------------------}

function generate;

begin

generate:=trunc(abs(122.5*(sin(ln(a)*x)+sin(cos(b)*x))));

end;

{-- ----------------------------------------------}

procedure add_in_llist;

var g: llist;

l: plist;

k, i, j: byte;

begin

k:=1; i:=1;

while (k<=length(s)) do

begin

new(g);

g^.inf:=i;

g^.nb:=nil;

j:=1;

while (j<=8) and (k<=length(s)) do

begin

new(l);

l^.inf:=ord(s[k])*generate(x,ord(s[k]),k);

l^.num:=j;

l^.next:=g^.nb;

g^.nb:=l;

k:=k+1;

j:=j+1

end;

g^.next:=gr;

gr:=g;

i:=i+1

end;

end;

{-- a-----------------------------------}

procedure summ_all;

var g: llist;

l: plist;

i: 1..8;

begin

g:=gr;

while g<>nil do

begin

l:=g^.nb;

i:=1;

while l<>nil do

begin

a[i]:=a[i]+l^.inf;

l:=l^.next;

i:=i+1

end;

g:=g^.next;

end;

end;

{------------------------------------------------}

end.

kript.pas:

program kuzik;

uses crt, kriptmod;

var x: integer;

i: 1..8;

pass: string;

l: Llist;

arr: array_type;

f: text;

begin

clrscr;

randomize;

{-- --}

x:=abs(random(9999-101))+101;

write('Password: '); textcolor(0);readln(pass);

add_in_llist(x,pass,l);

summ_all(l,arr);

assign(f, 'shadow');

rewrite(f);

writeln(f,x);

for i:=1 to 8 do write(f,FromIntToString(arr[i]));

writeln(f);

close(f);

textcolor(2);

writeln('User added in base.');

repeat until keypressed;

end.

unkript.pas:

program kuzik;

uses crt, kriptmod;

var x: integer;

i: 1..8;

pass, pass1: string;

l: Llist;

arr: array_type;

f: text;

s, s1: string;

begin

clrscr;

write('Password: '); textcolor(0);readln(pass);

{-- --}

assign(f,'shadow');

reset(f);

{-- --}

readln(f,x);

{-- --}

readln(f,pass1);

close(f);

{-- --}

add_in_llist(x,pass,l);

summ_all(l,arr);

for i:=1 to 8 do s1:=s1+FromIntToString(arr[i]);

{-- shadow--}

if (pass1=s1)

then begin

textcolor(2);

writeln('Password correct.')

end

else begin

textcolor(4);

writeln('Password incorrect!');

end;

repeat until keypressed;

end.



      ©2010