AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren

Reverse a hash function?

Ein Thema von user · begonnen am 26. Nov 2010 · letzter Beitrag vom 26. Nov 2010
Antwort Antwort
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
Benutzerbild von JasonDX
JasonDX
(CodeLib-Manager)

Registriert seit: 5. Aug 2004
Ort: München
1.062 Beiträge
 
#2

AW: Reverse a hash function?

  Alt 26. Nov 2010, 17:04
Does it possible to decrypt the hash from this function?
Well, you map a string of arbitrary length to a finite field, so you do have some collisions. It therefore is not always possible to 'decrypt' the hash (in the sense of getting s from h(s), h being the hash function), but you can always find a string s' that hashes to the same value, hence h(s) = h(s'). The next question would then propably be how long it takes to find such string.

greetz
Mike
Mike
Passion is no replacement for reason
  Mit Zitat antworten Zitat
mkinzler
(Moderator)

Registriert seit: 9. Dez 2005
Ort: Heilbronn
39.851 Beiträge
 
Delphi 11 Alexandria
 
#3

AW: Reverse a hash function?

  Alt 26. Nov 2010, 17:19
Not being reversible is the nature of a hash function
Markus Kinzler
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
43.017 Beiträge
 
Delphi 12 Athens
 
#4

AW: Reverse a hash function?

  Alt 26. Nov 2010, 17:43
hash = one-way encryption

This can not be reversed.


[edit]
Wo kommen denn "plötzlich" die vielen Antworten her?
(grad eben waren die noch nicht da)
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests
  Mit Zitat antworten Zitat
user

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

AW: Reverse a hash function?

  Alt 26. Nov 2010, 18:44
Hmm.. I think reversing the function is bad idea. I am on panic and I have wrong concept in my program. Sorry, I'm still learning. Thanks.
  Mit Zitat antworten Zitat
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:41 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz