Hash: A message digest which is generated from a text and can't reproduce from a different text
Hashing: Producing message digest when given a text
- one input - one output
- can't reproduce input from output
- modidfing input means change in hash
Hashing funtion(Hash Algorithm): A function that can be used to map out data of random size to data of fixed size. Some hashing algorithms are MD4, SHA(Secure Hash Algorithm, SHA-1(160 Bits), SHA-2(256 Bits))
Use Case of Hashing
- comparison large inputs
- finding records(finding hashes)
- use for cyptographic purposes(digital signatures)
- avoid duplication(in databases)
- Can use to store passwords and then compare it
Encryption: process of encoding to be fetched later by an entity using decryption key, protection of sensitive data; Protect data from unauthorized users
plain text -> encryption -> cipher text
Asymmetric Encryption(Public Key Encryption): Uses two different keys, public key known by everyone to encrypt plain text and private key to decrypt the cipher text(bit slow) Symmetric Encryption: uses same key for encryption and decryption, both parties(sender and reciever) should have keys Hybrid Encryption: mixture of above, using strengths and minimizes weakness Algorithms: AES(symmetric encryption) and PGP(asymmetric encryption)
Hashing is used to validate the integrity of content by detecting the modifications and thereafter changes to hash output; one-way function; irreversible, can't go back from hash digest to input
Encryption encodes data for maintaining data confidentiality and security, require keys reverse the encrypted text to plain text; two-way function, reversible using a private key