Hashing Algorithms
Im sure hashing would is used to create a shorter fixed length value or am i on the wrong topic??
that is right. not necessarily shorter (think of the hash of a 1-character string), but reasonably small, in a size that is big enough to make collisions very very unlikely to happen
Explain the effect of a small change in the input to a good hashing algorithm has on its output. Use a real-world example to help explain your answer.
an hashing algorithm should destroy the meaning of the original data. if you can analyze the output to infer information from the input, then the hash algorithm was bad.
with this bad hashing function you can see the correlation between the last character in the input string and the last digit in the output. now if you see the hash "1234566" you can make a good guess that the input was "cloud0"
with this hash function, if you look at the output you have no idea what the input is. this makes storing [salt-]hashed passwords safe
so pretty much a hashing function should behave like a PRNG that takes the input as a seed to generate one single output
print bad_hash("clouds1") // prints "1234567"print bad_hash("clouds1") // prints "1234568"print bad_hash("clouds3") // prints "1234569"
print good_hash("clouds1") // prints "1234567"print good_hash("clouds1") // prints "3954328"print good_hash("clouds3") // prints "9523452"
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now