Here's a short question: does a hash function with configurable length exist? And if not, why not? Would it be a problem?


I think this question was already discussed here and the answer was like that it is actually possible, as examples like Skein and Keccak show. They participated at SHA3-Competition in 2012, particularly the so called NIST hash function competition. Skimming the functionality of the winner of this competition, the currently representative of the SHA-3 algorithm, could help you to comprehend that there is at least one efficient example for an algorithm, which in a sense allows hash length manipulation.


So for example the Hash function Keccak is, as Tom Leek told already, a so called Sponge-Hash and gives the opportunity to manipulate the length of the resulting Hash by default. Interesting for you to see are, all in all, the following two parameters Keccak is taking:

Parameter: L

If we just take exemplarily a quick look at its functionality we will see, that Keccak works with a state vector b which is initialized with 0 , containing 25 words w and each of this words consist of w = 2 ^ L Bits. Consequential to this, the state vector has a length of b = 25 * w .

Parameter: n

n represents the bit length of the desired hash value. In the version that was handed in for the competition, there was L = 6 , what implies that the length of the actual hash value will be between 224 and 512 Bits. But as you can see the resulting length of the hash is variable , depending on the input parameters we discussed so far. The accosted length of the hash, in the range between 224 and 512 Bits, is just customary as you could change the L parameter to manipulate the length.

Of course the Keccak, respectively since for now two years the officially SHA-3-Algorithm, does not end here and this was not a very sophisticated description. Actually furthermore there will be gradually XOR-Encryption, which is comparable to a classical block cipher. But for further details you could take a look at the wikipedia article here. I think going into details related to technically sophistrys would be more as needed to answer your question.

I just wanted to exemplary knock up the initialization of the needed parameters to show you that there are ways of manipulating the resulting hash length.


Hash functions with a configurable output length exist, but we don't really call them "hash functions". We have Key Derivation Functions. Also, some hash function designs naturally allow for a configurable output length, in particular Sponge functions, a prime example behind Keccak, the soon-to-be SHA-3 standard. Indeed, NIST is currently drafting the standard and that includes SHAKE128 and SHAKE256, two usages of Keccak with a configurable output length.

Your Answer

