libtom / libtomcrypt

LibTomCrypt is a fairly comprehensive, modular and portable cryptographic toolkit that provides developers with a vast array of well known published block ciphers, one-way hash functions, chaining modes, pseudo-random number generators, public key cryptography and a plethora of other routines.
https://www.libtom.net
Other
1.51k stars 449 forks source link

Tiger Hash - Question #632

Closed NickBrighten closed 4 months ago

NickBrighten commented 9 months ago

I have a question about the tiger hash algorithm...

So, in this library the tiger hash algorithm is integrated as it is tiger128,3 / tiger160,3 and tiger192,3... Is it possible to adopt or integrate the tiger128,4 / tiger160,4 and tiger192,4 algorithm??? Or is any option to get the tigerXXX,4 from existing code???

sjaeckel commented 9 months ago

Wow PHP ... I don't know what else I should say :D

The current code obviously doesn't support it, since it's a special PHP variant of that hash.

It looks like this could be added, one way would be to

  1. add a flag to the existing struct tiger_state
  2. extend tiger.c by a new const struct ltc_hash_descriptor tiger4_desc with an unused hash ID and no OID
  3. a new init function tiger4_init() that calls tiger_init() and sets the flag
  4. extend the [s]s_tiger_compress() by the 4th pass if the flag is set
  5. add testvectors (no idea where to get reliable ones from, since not even PHP has them FMU)
NickBrighten commented 9 months ago

thx for your comment... But is it really PHP only???

sjaeckel commented 9 months ago

thx for your comment...

NP - feel free to open a PR once you've implemented it

But is it really PHP only???

There's https://crypto.stackexchange.com/a/28991 (and https://stackoverflow.com/a/33314933) which are the only online references I can find on it, so I'm pretty sure it's PHP specific.

TBH I'm not really certain whether we should even include it as an option, but since we're a cryptographic toolkit I wouldn't have a too big problem with it.

NickBrighten commented 8 months ago

Hey sjaeckel - implementation of the Tiger2 (Tiger algorithm with 4 passes) are very simple - will push soon as possible to you :-)