Skip to main content

Hashing

Hash functions take any arbitrary length of bits and run operations on them such that the output is always a fixed length.

In case of SHA256, the output is always 256 bits but the final output converts this to hexadecimal value. This means, every 4 bits is converted to one hexadecimal character. So the final output has 64 characters.

Word Size

Similar to how programming languages parses bits into different sizes based on the datatype, hashing functions which work on pure bits will split data into the size of it's preference.

In case of SHA 256, it splits the data into 512 bit words. Then works on these words to generate the final hash.

Checksum

Checksum is also similar to hashing but it's use case is different. It's not about securing data but only about ensuring data integrity.

hashing is for security, checksum is for integrity

Hashing is used for cryptographic security whereas checksum is used for data integrity.