reversing a hash function

From: Skybuck Flying (nospam_at_hotmail.com)
Date: 08/27/04


Date: Fri, 27 Aug 2004 19:49:27 +0200

Hi,

I have this hash function:

function function_hash(
 const a : word;
 const b : longword;
 const c : longword;
 const d : byte ) : longword;
 result :=
 (
  (
   ((a) shr 1) xor (b) xor (c) xor (d)
  ) and (63)
 );

Or for example in C:

#define function_hash (a, b, c, d) \
 ((((a) >> 1) ^ (b) ^ (c) ^ (d)) & (63))

These two hash functions are the same and will always produce a value
ranging from 0 to 63.

Let's say a, c, d and hash are known and b is unknown.
Is it possible to find all B for hash value X

For example

Find all hash values for B where a=1 c=2 and d=3 and hash=10.

I could ofcourse simply try out all values for B... but maybe there is a
faster way ?

Let's say a,c, hash are known and b,d are unknown.

Q2: Is it still possible to find all a, c where hash = x ?

For example a=1, c=2, hash = 10

I could ofcourse again try all possible values for b and d but again maybe
there is a faster way ?

Thanks for any help,
  Bye
     Skybuck.



Relevant Pages

  • Making Datatypes Constant and Emulating Const Correctness
    ... Being relatively new to Perl with Java and bits of C under my belt, ... I'm new to C+++, too, but remember a number of uses for the const keyword ... an array to some analizer function as a constant strongly signals that no ... some reference (e,g. a blessed hash reference) ...
    (comp.lang.perl.misc)
  • Re: Question about tcp hash function tcp_hashfn()
    ... But it still does not fix artifacts with for example const IP and random ... ports or const IP and linear port selection. ... Values must be specially tuned to be used with Jenkins hash, ...
    (Linux-Kernel)
  • Re: CMap and struct
    ... So make it const. ... The HashKey function inside CMap cannot produce any hash value from ... SDataType objects; SDataType objects should be able to turn into integer ...
    (microsoft.public.vc.mfc)
  • Re: Hash value not correct in CryptVerifyDetachedMessageSignature
    ... > to verify it with Hash calculated using OpenSSL. ... const BYTE* pbDetachedSignBlob, ... DWORD cbDetachedSignBlob, ...
    (microsoft.public.platformsdk.security)
  • Re: Some comments on "super fast hash"
    ... SFH seems reasonably good and certainly is fast. ... > a hash, and SFH does not. ... The latest versions of each hash function which leverages this ... it must behave worse on other key sets. ...
    (comp.programming)