iMPA Newbie
Joined: 26 May 2001 Posts: 9 Location: Spain
|
Posted: Fri Jan 11, 2002 7:00 pm Post subject: Simply text encryption |
|
|
Well, simply text encryption...
This encription algorithm is based in the 'Solitaire' algorithm
by Bruce Scheiner (author of 'blowfish' too)
For more informaticon visit Bruce Page (http://www.counterpane.com)
This method add (to encript) ASCII values of the input and
the pass, character to character. Then convert the value obtained to ASCII char
The reverse method is used to decrypt (obviusly)
Sorry about my poor english... (reduced comments)
Code: |
Title Text Encription
DIALOG CREATE,Text Encryption,-1,0,350,300
DIALOG ADD,GROUP,ginput,5,5,340,100,Input
DIALOG ADD,EDIT,input,20,10,330,80,Try this easy and powerful text encription algorithm,multi,wrap,scroll
DIALOG ADD,GROUP,goutput,110,5,340,100,Output
DIALOG ADD,EDIT,output,125,10,330,80,,readonly,multi,wrap,scroll
DIALOG ADD,GROUP,Actions,215,5,340,60,
DIALOG ADD,STATUS,STATUS,Text encription in plain VDS by iMPA
DIALOG ADD,TEXT,text,230,10,,,Password:
DIALOG ADD,EDIT,pass,228,60,100,,vds
DIALOG ADD,BUTTON,encript,225,180,75,24,Encrypt
DIALOG ADD,BUTTON,Decript,225,255,75,24,Decrypt
DIALOG ADD,PROGRESS,pro,255,10,330,15
DIALOG SHOW
:Evloop
wait event
goto @event()
goto evloop
:encriptBUTTON
%%input = @dlgtext(input)
%%pass = @dlgtext(pass)
%%output = ""
%i = 1
%p = 1
repeat
rem step by step
%%in = @substr(%%input,%i,%i)
%%pa = @substr(%%pass,%p,%p)
%1 = @diff(@asc(%%in),32)
%2 = @diff(@asc(%%pa),32)
rem to avoid binary characters
%3 = @mod(@sum(%1,%2),@diff(256,32))
%%output = %%output@chr(%3)
%i = @succ(%i)
%p = @succ(%p)
if @greater(%p,@len(%%pass))
%p = 1
end
dialog set,pro,@format(@fmul(@fdiv(%i,@len(%%input)),100),3.0)
until @greater(%i,@len(%%input))
dialog set,output,%%output
dialog set,pro,0
goto evloop
:DecriptBUTTON
%%input = @dlgtext(input)
%%pass = @dlgtext(pass)
%%output = ""
%i = 1
%p = 1
repeat
rem step by step
%%in = @substr(%%input,%i,%i)
%%pa = @substr(%%pass,%p,%p)
%1 = @asc(%%in)
%2 = @asc(%%pa)
%3 = @sum(@diff(%1,%2),64)
rem we add 64 according with the encription procedure
if @greater(0,%3)
%3 = @sum(%3,@diff(256,32))
rem to prevent errors
end
%%output = %%output@chr(%3)
%i = @succ(%i)
%p = @succ(%p)
if @greater(%p,@len(%%pass))
%p = 1
end
dialog set,pro,@format(@fmul(@fdiv(%i,@len(%%input)),100),3.0)
until @greater(%i,@len(%%input))
dialog set,output,%%output
dialog set,pro,0
goto evloop
:Close
exit
|
_________________ share what you know, learn what you don't |
|