home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
mbug
/
mbug097.arc
/
NAME.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1979-12-31
|
3KB
|
112 lines
program encrypt_system;
{ This program names and encrypts an operating system }
{ prior to storage on disk. }
{ THIS PROGRAM IS NOT TO BE RELEASED TO ANYONE !!!! }
{ THIS MEANS YOU !!!! }
{ Matches system version 2.2, 17/5/88 and after. }
{ Actually this does not do any encryption as that }
{ section of the operating system no longer works! }
var
in_file, out_file : file;
buffer : array [0..$27FF] of byte;
in_file_name, out_file_name : string [14];
name : string [30];
i, ch_byte, start_check, end_check, name_pos, encrypt_start, encrypt_end,
rot_val : integer;
check_sum, encr_byte : byte;
key : char;
label
end_loop;
begin
if paramcount<>2 then
begin
write(^J'Enter source file name - ');
readln(in_file_name);
write(^J'Enter destination file name - ');
readln(out_file_name);
end
else
begin
in_file_name:=paramstr(1);
out_file_name:=paramstr(2);
end;
assign(in_file,in_file_name);
reset(in_file);
blockread(in_file,buffer,80);
close(in_file);
repeat
write(^J'Enter name - ');
readln(name);
writeln(^J'This disk belongs to ',name,'.'^J);
write('Is this correct ? ');
repeat
read(kbd,key);
key:=upcase(key);
until (key='Y') or (key='N');
writeln(key,^J);
until key='Y';
for i:=succ(length(name)) to 30 do
name[i]:=#0;
for i:=$1000 to $27FF do
begin
(*
{ start of boot code to check }
if (buffer[i]=$FF) then
if (buffer[succ(i)]=$11) then
if (buffer[i+2]=$22) then
start_check:=i;
{ end of boot code to check }
if (buffer[i]=$FF) then
if (buffer[succ(i)]=$33) then
if (buffer[i+2]=$44) then
end_check:=i;
*)
{ start of space for user name }
if (char(buffer[i])='!') then
if (char(buffer[succ(i)])='@') then
if (char(buffer[i+2])='#') then
begin
name_pos:=i;
goto end_loop;
end;
(*
{ start of area to encrypt }
if (buffer[i]=$98) then
if (buffer[succ(i)]=$76) then
if (buffer[i+2]=$54) then
encrypt_start:=i;
if (buffer[i]=$12) then
if (buffer[succ(i)]=$34) then
if (buffer[i+2]=$56) then
encrypt_end:=i;
*)
end;
end_loop:
for i:=1 to 30 do
buffer[pred(name_pos+i)]:=byte(name[i]);
(*
check_sum:=0;
for i:=start_check+4 to end_check-1 do
begin
rot_val:=(buffer[i] + i) and 7;
ch_byte:=buffer[succ(i)];
ch_byte:=lo((ch_byte+(ch_byte shl 8)) shr rot_val);
check_sum:=lo(check_sum+ch_byte);
end;
encr_byte:=0;
for i:=encrypt_start to encrypt_end+3 do
begin
encr_byte:=lo(encr_byte+check_sum);
buffer[i]:=buffer[i] xor encr_byte xor lo(i);
end;
*)
assign(out_file,out_file_name);
rewrite(out_file);
blockwrite(out_file,buffer,80);
close(out_file);
end.