Blockchain Basics: How is a Hash Different than Encryption

Blockchain Basics: How is a Hash Different than Encryption

When we talk about hashes, we are not referring to corn beef. In the Factom world and cryptography, in general, a hash is a one-way function. This means there is no cryptographic key that unlocks the data that has been hashed.

Hash functions have been used for years to map data of any size to data of fixed size. This is critical because it allows us to secure a lot of information while only using a small digital footprint within our blockchain and others we anchor into for security.

At Factom we also use hashes to secure large records (over 10kb) and private files or data. These go into the Factom blockchain as entries on a chain.

We often refer to hashes as digital fingerprints of data because they allow us to prove that a file existed in a particular format at a given time without having to reveal the data in the file. We think this is cool and important to data and system integrity.

On the other hand, encryption is a two-way function. With a cryptographic key, you can unlock or decrypt something that was previously encrypted. This allows you to access the original data with the proper key. We also encrypt data at Factom, but it's important to remember that once data is published to the Factom blockchain, it will live in the public's view for perpetuity. Encryption can and is often broken, so it is best only to publish hashes of private or confidential data.

So to summarize, a hash is a one-way function and encryption is a two-way function. You can not derive the original data from a hash, only prove it existed. Encrypted data can be decrypted, revealing the information. Encryption has keys that unlock the data. Hashes do not have keys, but you will always get the same hash from the same piece of data. If the data has been changed at all, the hashes will no longer match.