sunplus.pas

来自「sunplus firmware decrypt tool」· PAS 代码 · 共 55 行

PAS
55
字号
{
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.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?