Lets ignore the question, if "excluding words of certain length" is "taking the length into comparison" or not. It does not matter.

What matters is, that it lead to a misunderstanding, and that some of my statements while this misunderstanding lasted, where based on that words of any length would be hashed.

Yes I did not read the formula. For all I can see, the exact formula does not matter.

What matters is, for any hash that results in a hash value in a finite range (e.g. the hash value is a 32 or 64 bit integer):

1) If words of arbitrary length (and that would mean an infinite amount of possible words) would be hashed, then to any chosen word, there may be another word with the same value.

2) If (as now clarified) only words within a specified range of lengths are used, then the amount of words is finite [1] too. Within such are finite list of words (even if the list has more entries, than there are hash values), a hash can be found, that will for a given subset of those words (the pascal identifiers) produce hash values, that are not produced by any other word in the full list.

[1] and finite is all that matters, hence I did not bother with the formula, and still do not.

I have not tested your hash, if it fulfils the 2nd point. It may well do.

Your test with using "random" is not a guarantee, but could be modified to iterate all possible words.

----------------

Remains the point, what happens if a new keyword is added.

I assume you use an int32 or int64? In which case the total amount of words is bigger than the amount of hash values, so outside the current keyword-list there are clashes (but they do not harm).

If the new keyword is found to have a clash with any other random word from the full list, then you need to find a new hash algorithm (or enable comparing the word itself, but that was what you try to avoid).

To me, the chance that I may have to redo the hash algorithm, falls under undesired maintenance cost.

On that you may disagree, but then everyone has to make there own decision what they see as maintainable (so long as it is ones own code / in a team different rules apply)