Einzelnen Beitrag anzeigen

Benutzerbild von Sir Rufo
Sir Rufo

Registriert seit: 5. Jan 2005
Ort: Stadthagen
9.454 Beiträge
 
Delphi 10 Seattle Enterprise
 
#7

Re: Verschüsselungs-DLL mit Fehlern

  Alt 21. Feb 2009, 11:40

was ist denn an einem formatierten Code unübersichtlich? das man sieht wie die Blöcke zusammenhängen?
Nun ja, jeder hat da ja eine andere Wahrnehmung ...
Delphi-Quellcode:
library PCrypt;

uses
  FastShareMem,
  SysUtils,
  Classes;

const
  list: array [1..62] of string =
    ( 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
      'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
      'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7',
      '8', '9', '0', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
      'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
      't', 'u', 'v', 'w', 'x', 'y', 'z' );
  list2: array [1..62] of string =
    ( '1', '2', '3', '4', '5', '6', '7',
      '8', '9', '0', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
      'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
      't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D',
      'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
      'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' );

function crypt1(s: string): string; stdcall;
var
  wert: array of byte;
  i, j: integer;
  ende: string;
begin
  s := s + 'A';
  randseed := 4546464;
  SetLength( wert, Length( s ) );
  ende := '';
  for i := 0 to Length( s ) - 1 do
    begin
      for j := 1 to 62 do
        if
          ( Copy( s, i, 1 ) = list[ j ] )
        then
          wert[ i ] := j;
      ende := ende + IntToStr( wert[ i ] ) + IntToStr( Random( wert[ i ] ) );
    end;
  for i := 0 to Length( s ) - 1 do
    begin
      for j := 1 to 62 do
        if
          ( Copy( s, i, 1 ) = list2[ j ] )
        then
          wert[ i ] := j;
      ende := ende + IntToStr( wert[ i ] ) + IntToStr( Random( wert[ i ] ) );
  end;
  result := ende;
end;

function crypt(s: string): string; stdcall; export;
var
  s1, s2: string;
begin
  s1 := crypt1( s );
  s2 := crypt1( s1 );
  result := s2;
end;

{$R *.res}

exports
  Crypt;
begin
end.
Kaum macht man's richtig - schon funktioniert's
Zertifikat: Sir Rufo (Fingerprint: ‎ea 0a 4c 14 0d b6 3a a4 c1 c5 b9 dc 90 9d f0 e9 de 13 da 60)
  Mit Zitat antworten Zitat