I was hoping to implement a software that allows testing a user-defined hash function for cryptographic properties (Meant to pique interest in cryptographic hash function for a school showcase), as well as compare them with well-known hash function to identify their hash functions strong points & weak points. However the property collision-resistance got me into a bit of a pickle.

The first obvious thought that occurred to me was the Birthday Paradox Attack, where given that we only with to find an instance of a hash collision (henceprob of hash collision should assumed to be 0.5 or above) thus if the hash function finds a collision on 2^(n/2) operations consistently.

The second option that I considered was to count the length of the hash value & determine the size of the pool for all possible hash values. From there on we prepare a plaintext list of that size to check if the hash values are distributed evenly across the hash value space.

The problem with the two proposed solution I given was that given that the hash value length is significantly large (256 bits or more) this might prove to be an hassle given the large amount of brute force needed to thoroughly check for collisions. Also I was hoping for a more refined way to identify their hash functions flaws.

I am currently looking at length extension attack, the way it functions sounds like a type of differential cryptanalysis attack, I was hoping that I can use this to derive a collision using the padding exploit. (By understanding how they pad. maybe I can use the same type of trick to result in a collision, am still unsure of how exactly it works so I might be completely wrong here)

Other than the methods mentioned above, is there any other ways that I can accomplish this?

  • 1
    $\begingroup$ Testing (implementations of) cryptographic algorithms as a black box is doomed to be useless as a convincing argument (much less as proof) that they work as expected. At best, such test can disprove that they work as expected, for a small class of possible failure modes. $\endgroup$ – fgrieu Oct 12 '15 at 13:08
  • $\begingroup$ Hence it is essentially impossible to prove a cryptographic hash function works without prior knowledge of the algorithm structure and inner working? $\endgroup$ – Last Oct 13 '15 at 3:48
  • 1
    $\begingroup$ Yes. And even with prior knowledge of the algorithm structure and inner working, the best we can do is give a convincing argument of security, not a proof in the mathematical sense. $\endgroup$ – fgrieu Oct 13 '15 at 5:38

I think calculation of probability is not a good idea. Because your pool is gonna greater when you want to work with complex hash algorithms (for ex: sha256/512...)It may work just for md5 or sha1. I suggest you to check out also Linear Cryptanalysis Attack to understand Differential Cryptanalysis deeply.

Good luck

  • $\begingroup$ Thanks, any recommended links to get started? The problem is I would be accepting user-defined hash functions as a class file, so i'm guessing for cryptanalysis I would need the .java file & also certain pattern matching algorithm to identify key aspects of the hash functions. $\endgroup$ – Last Oct 13 '15 at 3:47
  • $\begingroup$ Java may not be proper for this kind of algorithms. If i were you i would use python or c. I suggest you to check this article: csrc.nist.gov/groups/ST/hash/documents/WATANABE_cr_criteria.pdf $\endgroup$ – aysebilgegunduz Oct 13 '15 at 12:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.