LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Thu Jan 10, 2002 9:03 pm Post subject: Binary Encryption |
|
|
Here is a binary encrypion script that iMPA posted on the
old board. It works very well and is a good replacement for
blowfish.dll
| Code: |
:BinaryEncryption
title [ binary encryption ]
dialog CREATE,[ binary encryption ],-1,0,360,200
dialog ADD,STYLE,STYLE,Verdana,8,,,BLACK
dialog ADD,GROUP,in,5,5,350,45,[ input ],,STYLE
dialog ADD,EDIT,input,22,10,310,19,
dialog ADD,GROUP,out,55,5,350,45,[ output ],,STYLE
dialog ADD,EDIT,output,72,10,310,19,
dialog ADD,GROUP,p,105,5,140,70,[ password ],,STYLE
dialog ADD,EDIT,pass1,122,10,130,19,,enter your password,password
dialog ADD,EDIT,pass2,147,10,130,19,,reenter your password,password
dialog ADD,STATUS,STATUS,[ iMPA ],STYLE
dialog ADD,BITBTN,bin,22,325,25,19,,...
dialog ADD,BITBTN,bout,72,325,25,19,,...
dialog ADD,GROUP,act,105,155,200,70,[ actions ],,STYLE
dialog ADD,BITBTN,encript,121,165,95,24,,[ encript ]
dialog ADD,BITBTN,decript,145,165,95,24,,[ decript ]
dialog ADD,PIECHART,pie,125,265,85,40,0
dialog SHOW
:Evloop
wait event
goto @event()
:binBUTTON
%f = @filedlg(,,,)
if @not(@null(%f))
dialog set,input,%f
end
goto evloop
:boutBUTTON
%f = @filedlg(,,,save)
if @not(@null(%f))
dialog set,output,%f
end
goto evloop
:encriptBUTTON
%%in = @dlgtext(input)
%%out = @dlgtext(output)
if @not(@both(%%in,%%out))
warn Please enter the 2 filenames !!
goto evloop
end
if @not(@equal(@dlgtext(pass1),@dlgtext(pass2)))
warn Passwords don't match
goto evloop
end
%%pass = @dlgtext(pass1)
binfile open,1,%%in,read
binfile open,2,%%out,create
%i = 0
%j = 1
while @not(@binfile(eof,1))
binfile seek,1,%i
%1 = @binfile(read,1,binary,1)
%2 = @asc(@substr(%%pass,%j,%j))
%3 = @mod(@sum(@substr(%1,1,@pred(@len(%1))),%2),256)
binfile write,2,binary,%3|
%i = @succ(%i)
%j = @succ(%j)
if @greater(%j,@len(%%pass))
%j = 1
end
rem graphical calcs
%q = @format(@fmul(100,@fdiv(%i,@binfile(size,1))),3.0)
dialog set,pie,%q
dialog set,status,[ iMPA ] ~ %q %
wend
binfile close,1
binfile close,2
info ..::[ ok ]::..
dialog set,status,[ iMPA ]
dialog set,pie,0
dialog clear,input
dialog clear,output
dialog clear,pass1
dialog clear,pass2
goto evloop
:decriptBUTTON
%%in = @dlgtext(input)
%%out = @dlgtext(output)
if @not(@both(%%in,%%out))
warn Please enter the 2 filenames !!
goto evloop
end
if @not(@equal(@dlgtext(pass1),@dlgtext(pass2)))
warn Passwords don't match
goto evloop
end
%%pass = @dlgtext(pass1)
binfile open,1,%%in,read
binfile open,2,%%out,create
%i = 0
%j = 1
while @not(@binfile(eof,1))
binfile seek,1,%i
%1 = @binfile(read,1,binary,1)
%2 = @asc(@substr(%%pass,%j,%j))
%3 = @diff(@substr(%1,1,@pred(@len(%1))),%2)
if @greater(0,%3)
%3 = @sum(256,%3)
end
binfile write,2,binary,%3
%i = @succ(%i)
%j = @succ(%j)
if @greater(%j,@len(%%pass))
%j = 1
end
rem graphical calcs
%q = @format(@fmul(100,@fdiv(%i,@binfile(size,1))),3.0)
dialog set,pie,%q
dialog set,status,[ iMPA ] ~ %q %
wend
binfile close,1
binfile close,2
info ..::[ ok ]::..
dialog set,status,[ iMPA ]
dialog set,pie,0
dialog clear,input
dialog clear,output
dialog clear,pass1
dialog clear,pass2
goto evloop
:Close
exit
|
_________________ Chris
Http://theblindhouse.com |
|