SHARE
TWEET

RANDOM ENCODE BY SKTHELIGHT

finalshare Jan 13th, 2017 97 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. unit unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
  9.   base64;
  10. const
  11.      cae='ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789!#$%&()[<=?@]^_|0123456789!#$%&()[<=?@]^_|' ;
  12. type
  13.  
  14.   { TForm1 }
  15.  
  16.   TForm1 = class(TForm)
  17.     Button1: TButton;
  18.     Button2: TButton;
  19.     Edit1: TEdit;
  20.     Edit2: TEdit;
  21.     Edit3: TEdit;
  22.     Label1: TLabel;
  23.     Label2: TLabel;
  24.     Label3: TLabel;
  25.     Label4: TLabel;
  26.     Label5: TLabel;
  27.     procedure Button1Click(Sender: TObject);
  28.     procedure Button2Click(Sender: TObject);
  29.   private
  30.     { private declarations }
  31.   public
  32.     { public declarations }
  33.   end;
  34.  
  35. var
  36.   Form1: TForm1;
  37.  
  38. implementation
  39.  
  40. {$R *.lfm}
  41.  
  42. { TForm1 }
  43. function ranEncode(x,flag:ansistring;Private_key:byte):ansistring;//Flag_STring
  44. Var
  45.    temp:ansistring;
  46.    i,j:longint;
  47.    k:byte;
  48. begin
  49.      temp:='';
  50.      x:=encodeStringBase64(x);
  51.      for i:=length(x) downto 1 do
  52.          temp:=temp+x[i];
  53.      for i:=1 to Private_key do
  54.          begin
  55.               temp:=flag+temp;
  56.               k:=random(25)+1;
  57.               for j:=1 to length(temp) do
  58.                   begin
  59.                        temp[j]:=cae[pos(temp[j],cae)+k];
  60.                   end;
  61.          end;
  62.      x:='';
  63.      for i:=length(temp) downto 1 do
  64.          x:=x+temp[i];
  65.      temp:='';
  66.      ranencode:=x;
  67. end;
  68. function ranDecode(x,FLAG:ansistring;Private_key:byte):ansistring;
  69. var
  70.    st,temp:ansistring;
  71.    i,j:longint;
  72.    k:byte;
  73. begin
  74.      temp:='';
  75.      for i:=length(x) downto 1 do
  76.          temp:=temp+x[i];
  77.      x:=temp;
  78.      temp:='';
  79.      for i:=1 to Private_key do
  80.          begin
  81.          for k:=1 to 25 do
  82.                        begin
  83.                             temp:=x;
  84.                             for j:=1 to length(temp) do
  85.                             temp[j]:=cae[pos(temp[j],cae)+k];
  86.                             st:=copy(temp,1,length(FLAG));
  87.                             if st=FLAG then begin x:=copy(temp,length(FLAG)+1,length(temp)-length(FLAG));break; end;
  88.                        end;
  89.          end;
  90.      temp:='';
  91.      for i:=length(x) downto 1 do
  92.          temp:=temp+x[i];
  93.      randecode:=decodeStringBase64(temp);
  94. end;
  95.  
  96.  
  97. procedure TForm1.Button1Click(Sender: TObject);
  98. begin
  99.       edit2.text:=ranencode(edit1.text,'FLAG',20);
  100. end;
  101.  
  102. procedure TForm1.Button2Click(Sender: TObject);
  103. begin
  104.      edit3.text:=randecode(edit2.text,'FLAG',20);
  105. end;
  106.  
  107. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top