hashing:
- converts data of any length to a fixed length
- one-way
- helps in checking the authenticity of the data transferred
encryption:
- converts data into unreadable format
- two-way
- helps in protecting the data transferred from unintended
receivers
1. A user logs in to an online shop.
- Uses encryption
- Only authenticated users are allowed to login, so they use a
password which helps in identifiying them
2. A user shares a document with another person over a
network. The document is not confidential, but the parties involved
want to be able to check the document has not been accidentally
corrupted on route.
- Uses hashing
- Hashing the document and comparing it with the hash of document
sent by the sender will identify whether the document is tampered
or not.
3. A user shares a document with another person over a
network and wants to be able to 'sign' it, so the recipient can be
sure who the document came from
- Uses encryption and hashing
- Here the document is signed => the document is hashed. The
sender encrypts the document with their private key. The receiver
just have to use the public key of sender to decrypt and to check
the signature
- The document is signed by hashing it and this will act as the
signature
- The receiver needs to compare the received hash value with the
hash of document.