navin346.eth 🫑
navin346.eth 🫑

@navin346

13 Tweets 2 reads Feb 24, 2023
#Hashfunctions : Tried to wrap my head around the complexity behind numbers on identifying collision hashes. πŸ‘‡πŸ‘‡ 1/10
A cryptographic hash function #⃣ is a mathematical function. You insert something in the function, it gives an output that is of fixed size 64 hexadecimal characters.⛓️ 2/10
Hexa-decimal characters include numbers from 0-9 and alphabetics. Each hexa-decimal is equal to 4 bits, which makes the size of hash output 256 bits(i.e. 2^256 possibilities)#βƒ£πŸ”’ 3/10
One property says hashes are collision-free πŸ₯·, i.e. two objects (say X & Y) shouldn't output the same hash value. When Xβ‰ Y | H(x) β‰  H(y). 4/10
However it is theoretically/probabilistically possible to have the same value, but it is computationally difficult to run and prove it. Let's see howπŸ‘‡ 5/10
A SHA-256 algorithm outputs 64 characters which can either be a lowercase letter or a number from 0–9. Which should mean that there are 2^²⁡⁢ distinct results. See the 2nd and 3rd tweets if you have any doubt πŸ€”
~6/10
For comparison, as of January 2023, Bitcoin was computing 250*10^3 quadrillion(250*10^18) SHA-256 hashes per second. Check the source πŸ‘‡~ 7/10
ycharts.com
Let’s say we were tried to perform a collision attack and would β€œonly” need to calculate 2^¹²⁸ hashes(half of the total possibilities). πŸ₯²
At the rate Bitcoin is going, it would take us 2¹²⁸/(250*10^18*24*60*60*365) = 43.2*10^9 years.
~ 8/10
Life of universe = 13.7Γ—10^9 years.
Hash identification time = 43.2*10^9 years.(@ 2^128).
πŸ™…β€β™‚οΈπŸ™…β€β™‚οΈ
Therefore it is not worth spending time on something that takes more than the life of universe's time. ~ 9/10
newscientist.com
Wrote this thread so that you don't have to spend time regretting(like I do now) on knowing the time to calculate hash collisions. ~ 10/10 πŸ‘‹ πŸ₯²
Check my calculation, forgot to add thisπŸ‘‡
The above calculation is only valid for SHA-256 function. Feel free to share your comments/corrections and feedback if anyπŸ«‚
Unroll @rattibha

Loading suggestions...