www.pudn.com > sunplus.zip > SUNPLUS.PAS, change:2006-12-14,size:994b
{
usage: sunplus.exe <filename.bin>
it will generate encoded/decoded _filename.bin
it just creates the file - without saying anything
version 0.02
bugfix
32bit compile (with LFN support!)
version 0.01:
first version
doesn't support long filenames (sorry)
says "runtime error 100" at end
}
program sunplus_decode_encode;
type l2=array[1..2]of longint;
l4=array[1..2]of l2;
var z:array[1..2]of l4;
y:l4;
i:longint;
f1,f2:file;
procedure xor_swap(var a:l2);
var b:longint;
begin
b :=a[1] xor $A5A5A5A5;
a[1]:=a[2] xor $A5A5A5A5;
a[2]:=b;
end;
begin
assign(f1,paramstr(1));
reset(f1,1);
assign(f2,'_'+paramstr(1));
rewrite(f2,1);
for i:=1 to filesize(f1) div sizeof(z)
do
begin
blockread (f1,z,sizeof(z));
xor_swap(z[1,1]);
xor_swap(z[1,2]);
xor_swap(z[2,1]);
xor_swap(z[2,2]);
y :=z[1];
z[1]:=z[2];
z[2]:=y;
blockwrite(f2,z,sizeof(z));
end;
close(f1);
close(f2);
end.