Einzelnen Beitrag anzeigen

user

Registriert seit: 13. Jul 2010
25 Beiträge
 
Delphi 2 Desktop
 
#1

Reverse a hash function?

  Alt 26. Nov 2010, 16:25
Delphi-Version: 2007
Does it possible to decrypt the hash from this function?

Delphi-Quellcode:
type TAdlerBytes = array[1..MAXINT] of Byte;
     TAdlerArray = array[0..16] of Integer;
     PAdlerBytes = ^TAdlerBytes;

implementation

{$R *.dfm}
function FNV32(PAB:PAdlerBytes;ACount:Integer):DWORD;
var i,APrime:DWORD;
begin
  APrime:= 16777619;
  Result:=2166136261;
  for i:=1 to ACount do
  begin
    Result:=Result*APrime;
    Result:=Result xor PAB^[i];
  end;
  //FNV stands for Fowler-Noll-Vo.
  //Read up on FNV at http://www.isthe.com/chongo/tech/comp/fnv
end;
procedure TForm1.FormCreate(Sender: TObject);
var
i:dword;
s:string;
begin
s:='aaabbbffggfd';
i:=fnv32(PAdlerBytes(s),length(s));
OutputDebugString(pchar(inttostr(i)));
end;

Geändert von mkinzler (26. Nov 2010 um 17:18 Uhr) Grund: Code-Tag durch Delphi-Tag ersetzt; replaced code tag with delphi tag for better code formating
  Mit Zitat antworten Zitat