Fully Homomorphic Encryption: An Example With Peanut Butter

Guy
Blockworm
Published in
3 min readJust now

--

Fully Homomorphic Encryption (FHE) is the Holy Grail of encryption technologies. While other forms of encryption allow users to communicate securely, FHE goes a step further by enabling data to be sent, manipulated, and returned — all while remaining in an encrypted state.

The end-to-end properties of FHE can power some incredible use cases. For example, it becomes possible to send sensitive medical data off for analysis, in the knowledge that this information doesn’t need to be decrypted at any point until it’s safely back in the hands of the sender.

In the context of blockchain (hello Inco), FHE enables transactions to be submitted to the network, processed, and confirmed before anyone else finds out what they actually are. That brings a whole new level of provable fairness to a wide range of applications, from gaming and NFT launches to trading and other DeFi activities.

In this article, we’ll take an “ELI5” look at FHE, using a (necessarily limited) analogy from the world of cooking.

Homomorphic Peanut Butter Mug Cake

Let’s use a very simple analogy for homomorphic encryption. We’re going to make a peanut butter mug cake, but we’re going to do it secretly.

Alone in your kitchen, mix together the following ingredients:

  • 1 1/2 tablespoons of vegetable oil
  • 2 tablespoons of peanut butter
  • 2 tablespoons of sugar
  • 1 egg
  • 2 tablespoons of flour
  • 1/4 teaspoon of baking powder
  • 2 tablespoons of milk
  • A few chocolate chips (optional, though seriously — add them)

Once they’re mixed well, spoon them into a large mug.

Next comes the clever bit. We’re going to borrow a friend’s microwave to cook these inputs, aka ingredients. However, because we don’t want our friend to eat the cake, or ideally even know what it is, we’re going to do it homomorphically.

Place the mug of ingredients into a cardboard box or a plastic container and close it. (Make sure it’s not airtight or things could get messy.) Take the container to your friend and ask them to heat it in their microwave for 2 minutes.

At the end, you can take the closed container back home, open it in the privacy of your kitchen, and eat your delicious dessert. Thanks to your friend, the contents of the mug have been homomorphically encrypted, aka microwaved without his or her knowledge of what they were.

Partial, Somewhat, And Full Homomorphic Encryption

The microwave is perfectly capable of cooking the mug cake, even though the ingredients are “encrypted” (hidden in a closed container).

Strictly speaking, this is an example of Partial Homomorphic Encryption (PHE). The Microwave “algorithm” only allows one operation to be carried out on the inputs: Cook them. You can’t use it to reverse the process and reduce the mug cake back to its constituent ingredients.

The “Kitchen” homomorphic encryption scheme does include other ways to process encrypted data. The “Freezer” algorithm allows you to freeze your mug cake for another day, while the “Leave Overnight On Counter Top” algorithm allows you to thaw it again, all while ensuring it stays safely and secretly in its container. However, there’s a limit to its abilities. You couldn’t use Kitchen to boil or deep fry the mug cake while it was shut in its box (even if you wanted to). This makes Kitchen “Somewhat Homomorphic”.

Similarly, in the context of actual cryptography rather than cookery-based analogies, different homomorphic encryption schemes permit different operations to be carried out on data. A scheme might only allow one operation, like addition of encrypted inputs (Partial HE). Or it might allow two functions, such as addition and multiplication (Somewhat HE).

The prize, of course, is an encryption scheme that allows any operation to be carried out on the encrypted inputs. This means that any computation can be completed, or any script executed, while maintaining complete security from start to finish.

This is the problem that Inco aims to address with its FHE blockchain platform, ushering in a new era of both trustlessness and privacy.

And that promises to be even more exciting than a choc chip peanut butter mug cake.

--

--

Guy
Blockworm

UK-based cryptocurrency communicator. Class of 2014.