All you need to know about sha256
What is SHA2
- A hashing algorithm.
- generate a fixed 256 (32-bit) length signature(or hash, or digest) string.
- Balanced security and speed
Why use hashing
To compare a long string(long text like an article, video, file, or whatever). we do not want to compare the exact long string again and again. we need something fast, and secure. To make this happen, sha256 does a few things:
- Scramble the input and make sure the output uniqueness
- Irreversibly. The input cannot be derived from the output
- Super complex process (e.g. this one, you will see below) making impossible the hack and the chance of hash collision very very low.
Do not confuse hashing with encryption
They serve different purposes.
Hashing is to make sure data integrity. using a one-way hash function to get output text. to use as an identifier of “content state”, then later use in validation (compute a hash string again based on the input).
Encryption is for data privacy. includes symmetric (same key used in encryption and decryption, e.g. AES) or asymmetric (private key+public key, e.g. RSA) . to convert plaintext into something not readable. to prevent sensitive data from being…