Jump to content

Hashing Algorithms

Mrcrysis2000
Go to solution Solved by Ciccioo,

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"

You guys where the best at helping me with my last question so i thought ill try it with this one :) (Plus my lecture takes forever to reply)

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.

 

Im sure hashing would is used to create a shorter fixed length value or am i on the wrong topic??

 

Thanks guys!

Link to comment
Share on other sites

Link to post
Share on other sites

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"
Link to comment
Share on other sites

Link to post
Share on other sites

Password protection is a very common real world example where hashing is used.

Link to comment
Share on other sites

Link to post
Share on other sites

Hashing is not used to shorten values it is used as an integrity check.

An example is md5.

md5 filename will always provide the same output as long as the files contents were not changed allowing you to make sure something was downloaded completely and was not corrupt.

Encrypting is used to turn values into non human readable characters and can be usually set to a certain character length like 128 or 215 character values shorter values are possible. The output of encrypted values are also decryptable so when you need the values they can be read by human eyes and make sense.

Encoding is used to convert values into another form that another program or computer can use.

Short answer:

Encrypting can be used to shorten values but is not what it was created for.

P.S. sorry for not answering but salts doesn't seem to be what you were looking for when you said values.

Link to comment
Share on other sites

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×