An SHA-$ 256 $ hash is one that is $ 64 $ digits long, where every digit is a hex value ($ 0 $-$ 9 $ and a-f). Here’s an example hash:
fffbdf$15$af$1$b$58$fc$48$d$5562$b$3$e$12$a$2$bb$9$ea$91$e$78324$f$3909723$bf$048396773$dc
Now, I would like to calculate the probability of a hash containing a (random) substring with $ n $ digits (the substring is also made up of hex values).
For example, what would be the probability of the hash containing a random 2-digit substring (e.g.‘c$8$’)?
Or what would be the probability of the hash containing a random $ 3 $-digit substring (e.g. ‘c$84$’)?
I did some numerical tests using OpenOffice, giving a 1.5% probability for a 3-digit string. But I don’t know how to exactly calculate the probabilities.
Thanks for your suggestions and hints!