Delphi-PRAXiS
Seite 3 von 3     123   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Passwort auf Sicherheit prüfen (https://www.delphipraxis.net/6351-passwort-auf-sicherheit-pruefen.html)

Cyberaxx 12. Mai 2011 14:07

AW: Passwort auf Sicherheit prüfen
 
Hallo

Ich weiß das dieser Thread verdammt alt ist aber ich mußte ihn nun ausgraben.
In der CodeLib habe ich die Funktion entdeckt, leider habe ich damit ein kleines Problemchen

es geht um diese beiden Zeilen
Delphi-Quellcode:
Byte(S[I-1]) := Byte(Password[I-1]) - Byte(Password[I]);
Byte(S[I-1]) := Byte(S[I-1]) - Byte(S[I]);
Vermerk vom Debugger
Der linken Seite kann nichts zugewiesen werden

Ich nutze Delphi 2010 Pro

Gruß
Cyber

p80286 12. Mai 2011 14:26

AW: Passwort auf Sicherheit prüfen
 
Ich vermute mal es geht hierum
Delphi-Quellcode:
function Differency: Extended;
  var
    S: String;
    L,I: Integer;
  begin
    Result := 0.0;
    L := Length(Password);
    if L <= 1 then Exit;
    SetLength(S, L-1);
    for I := 2 to L do
      Byte(S[I-1]) := Byte(Password[I-1]) - Byte(Password[I]);
    Result := Entropy(Pointer(S), Length(S));
  end;
Dann könnte Dir evtl
Delphi-Quellcode:
S: ansistring;
weiter helfen. (oder sogar S:shortstring ?)
Soweit ich weiß hat D2010 im String schon 16Bit-Chars, Und da dürfte der Hund begraben sein.

Gruß
K-H

Cyberaxx 12. Mai 2011 17:03

AW: Passwort auf Sicherheit prüfen
 
Danke das war der Ansatz den ich brauchte

Delphi-Quellcode:
  function KeyDiff: Extended;
  const
    Table = '^1234567890ß´qwertzuiopü+asdfghjklöä#<yxcvbnm,.-°!"§$%&/()=?`QWERTZUIOPÜ*ASDFGHJKLÖÄ''>YXCVBNM;:_';
  var
    //S: String;
    S: AnsiString;
    L,I,J: Integer;
  begin
    Result := 0.0;
    L := Length(Password);
    if L <= 1 then Exit;
    S := Password;
    UniqueString(S);
    for I := 1 to L do
    begin
      J := Pos(S[I], Table);
      if J > 0 then S[I] := AnsiChar(J); // <-- ebenfalls abgeändert Char in AnsiChar, sonst meckert der Compiler erneut :)
    end;
    for I := 2 to L do
      Byte(S[I-1]) := Byte(S[I-1]) - Byte(S[I]);
    Result := Entropy(Pointer(S), L-1);
  end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 05:25 Uhr.
Seite 3 von 3     123   

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz