T
T
Tolik2014-08-09 21:10:34
C++ / C#
Tolik, 2014-08-09 21:10:34

How do you like my hashing algorithm?

Created my own hashing algorithm. When you change one bit, the hash changes completely, its length is always 64 (except for spaces). There are no collisions on the range 00000..99999. The truth works slowly (regarding sha* for example). But on the other hand, it is protection from the selection or search for those same collisions. Here is the actual code .
PS I did everything somehow and therefore the constants are random numbers obtained by the Python script:
["%.8X" % random.randint(0, 2 ** 32 - 1) for i in range(0, 8)]
PPS If I liked it, you can safely use it. I'm not from the NSA :)
Moders, why are you deleting answers? I laughed so hard, and you removed everything. Even if there is harsh criticism, it's funny. If possible, return the answers =)
UPD: Collisions are one thing. But I have seen in hashes 3-5 identical digits in a row (in one of the eight numbers that make up the hash). I'm sure it's a hole. I'll try to make her

Answer the question

In order to leave comments, you need to log in

4 answer(s)
J
jcmvbkbc, 2014-08-09
@jcmvbkbc

The internal state in unsigned int and char *data are errors: char can be signed or unsigned, and int can have different widths depending on the system.
Further, you shuffle the input data into a hash byte by byte, this is a hole for differential cryptanalysis.
Further, you drag the state in ints, and during the hashing of one byte, your state does not scroll completely (your shifts, by a maximum of 3, will shift the state by a maximum of 24 bits out of 32 for a hashing cycle). Not only is this sloppy, but it also means that the higher and lower parts of the hash words will have different structures.
In short, even without deepening into the analysis, it is clear that the algorithm is ill-conceived and weak.
Even though sha1 does more rounds than your product.
In addition, you obviously lack knowledge about how the quality of cryptographic hash algorithms is evaluated.

P
Push Pull, 2014-08-09
@deadbyelpy

Thank you, I haven’t laughed like that for a long time, no offense, but you can do 10 such hash functions a day.
I don't see anything special in the code. You were bored, so you shared it?

S
Spetros, 2014-08-09
@Spetros

Length 64 in what units? In beats? Then the range of 00000..99999 input values ​​for collision search is too small.
The code is also so-so, the hash should be calculated in a loop without counters.
And here, if you submit too much data, then an overflow will occur with all the consequences.

T
throughtheether, 2014-08-10
@throughtheether

First of all, it's not bad for a student. Secondly, I personally do not understand the scope of this hash function. For security-related problems, there are already proven solutions. For the problems associated with the deterministic distribution of objects across containers (example: load sharing a la etherchannel, ECMP), it is too slow. Thirdly, the author will be even more done if he finds collisions on his own.

constants are random numbers
In my opinion, an attempt to add "randomness" to an algorithm without a thorough study of it is premature and may lead to false confidence in the "safety" of the algorithm.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question