A Fast New Cryptographic Hash Function

How to make Tiger Code Work on Misrosoft Visual Studio

We would like to thank all the people who sent us suggestions on how to make the Tiger code work on Misrosoft Visual Studio. We quote here several of them.
  1. Albertas Vyšniauskas wrote:
    Hello Eli Biham,
    I have a solution for fixing your Tiger's reference implementation to make  
    it work compiled with Microsoft Visual Studio.
    In file 'tiger.c' changing from this:
    #define round(a,b,c,x,mul) \
             c ^= x; \
             a -= t1[(byte)(c)] ^ \
                  t2[(byte)(((word32)(c))>>(2*8))] ^ \
    	   t3[(byte)((c)>>(4*8))] ^ \
                  t4[(byte)(((word32)((c)>>(4*8)))>>(2*8))] ; \
             b += t4[(byte)(((word32)(c))>>(1*8))] ^ \
                  t3[(byte)(((word32)(c))>>(3*8))] ^ \
    	   t2[(byte)(((word32)((c)>>(4*8)))>>(1*8))] ^ \
                  t1[(byte)(((word32)((c)>>(4*8)))>>(3*8))]; \
             b *= mul;
    to this:
    #define round(a,b,c,x,mul) \
             c ^= x; \
             a -= t1[(byte)(c)] ^ \
                  t2[(byte)(((word32)(c))>>(2*8))] ^ \
    	   t3[(byte)((word64)(c)>>(4*8))] ^ \
                  t4[(byte)((word64)(c)>>(6*8))] ; \
             b += t4[(byte)(((word32)(c))>>(1*8))] ^ \
                  t3[(byte)(((word32)(c))>>(3*8))] ^ \
                  t2[(byte)((word64)(c)>>(5*8))] ^ \
                  t1[(byte)((word64)(c)>>(7*8))]; \
             b *= mul;
    seems to help. I have no idea why original code doesn't work, maybe a  
    Microsoft compiler's bug.
    Would be nice to hear if this helped.
    Albertas Vyšniauskas
  2. Jeff Simmons wrote:
    A friend of mine sent me the following description of a problem he was
    having getting the Anderson/Biham Tiger hash to compile under MSVC++.
    Rather than diving into the MS compiler, which I have very little
    experience with, I thought I'd post here and see if anyone knows anything
    about it.
    Thanks in advance for any assistance, I'll forward all replies to the
    programmers (it's a distributed, GPL'ed database that doesn't want to
    show it's face in public just yet ... ).
    > Ok, here is a complete run-down of the problem at hand:
    > --------------------------------------------------------
    > The tiger hash reference code that is available at
    > (http://www.cs.technion.ac.il/~biham/Reports/Tiger/) compiles and runs
    > fine on gcc (even cygwin!), but not with MSVC++ 6.0. The tiger hash code
    > uses an 'unsigned long long int', which is an unsigned 64bit number. 
    > MSVC++ does not support this type, but the code compiles when you
    > substitute 'unsigned __int64' for the type.
    > However, the testtiger program that comes with the source does not
    > output the correct hash values under win32/MSVC++ 6.0 -- there seems to
    > be no relation to the correct output.
    > The authors of the tiger hash have also released a 32 bit only version
    > of their hash code, which compiles without problems under MSVC++.
    > However, it also outputs incorrect hash values. To make matters worse,
    > the output of the hash function for these two different versions
    > compiled on MSVC++ is different!
    > Does anyone have a clue as to what needs to be done in order to get the
    > tiger hash to compile correctly under MSVC++??
    > (The MSVC++ has sp3 applied)
    Jeff Simmons                                              jeff@punk.net 
         Simmons Consulting - Network Engineering and Administration
    Punknet - what happens when a bunch of computer geeks with way too much
    	free time and free hardware get pissed off at their ISP.
    "You guys, I don't hear any noise.  Are you sure you're doing it right?" 
                   -- My Life With The Thrill Kill Kult
  3. Drew Phillips drew@drew-phillips.com wrote:
    I have attached the updated files, and included a diff of the original 
    tiger.c and the one that works in vc++.
    The MS compiler doesnt support long long's but they do have a type 
    called __int64 which you can specify as
    signed or unsigned.  Then the only other differences are removing LL 
    from the end of the hex values.
    Drew Phillips
  4. Larry Hastings wrote:
    Attached is a ZIP of Tiger which I've modified to compile under 
    Microsoft Visual Studio 6.0.  It still builds fine under GCC (I tested 
    under Linux).
    Here is a list of changes:
        * Microsoft, in their infinite wisdom, decided to give 64-bit ints
          their own keyword (__int64) and a novel suffix (i64).  I used
          preprocessor hackery to handle this.  This was the biggest change,
          touching both tiger.c and sboxes.c.
        * VC++ complained about missing prototypes for strlen() and printf()
          in testtiger.c, so I added the appropriate header files.
        * VC++ pointed out that the register word i; in tiger_compress_macro
          in tiger.c was never used, so I removed it.
    I hereby bequeath my changes to you, in the hope that you will release 
    them to the public under the same astonishingly permissive license as 
    with the rest of Tiger.
    Best wishes, and thanks for Tiger,