Amazon Interview Question: difference between "hashing a... |

Interview Question

Software Development Engineer Interview Dublin, Co. Dublin

difference between "hashing a string" and "encrypting a

  string". Then: is it possible to find two elements for which the hash is the same?

Interview Answer

3 Answers


you can't "go back" from a hash. You can go back from encription if you know the secret (say password, private key, whatever).
Second question: yes but then you have a problem.

Interview Candidate on 23 Feb 2011

1. Encryption uses a secret key while hashing does not require any key.
Moreover, hash is one-way but encryption can be reversed by a decryption operation.

2. Yes, that's called hash collision, which although a low probability occurrence, does exist.

Neha on 5 Apr 2012

Decryption of encrypted string is possible. But we cannot say same thing for hashing. Because hash is one way operation. Q2:Low probability, it is possible using brute force

Anonymous on 9 Apr 2019

Add Answers or Comments

To comment on this, Sign In or Sign Up.