Skip to content

Instantly share code, notes, and snippets.

@rusrushal13
Last active February 21, 2020 04:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rusrushal13/147d96bf73ae1a5f3cdb521070f1c2b4 to your computer and use it in GitHub Desktop.
Save rusrushal13/147d96bf73ae1a5f3cdb521070f1c2b4 to your computer and use it in GitHub Desktop.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment