From Zero to Hero in Zero Knowledge Proofs [Part 1]

Hira Siddiqui
Coinmonks

--

This is the first part of the series that takes you from absolute ground zero in ZKPs to a fairly advanced level. We will start from the absolute basics and then move onward and upward. Subscribe to get regular updates!

Learning ZKPs is hard. No doubt about that. The math seems like rocket science and the concept seems fishy. However, like any science, it can be taught and learned.

In this first section, we will start by refreshing cryptography concepts that will help us understand ZKPs.

Cryptography

Cryptography is the practice and study of techniques for secure communication so that only those for whom the information is intended can read and process it.

Some of these techniques are also used in Zero Knowledge Proofs. Therefore, before diving deeper into our course, we will first review these concepts.

Hash functions

A hash function is a mathematical function or algorithm that takes a variable number of characters (called a “message”) and converts it into an output string with a fixed number of characters (called a hash value or, a hash).

It can be denoted as:

f(m)=H

where f is the hash function

m is the message

H is the resultant hash

Hash functions have specific properties that make them very useful in various cryptographic protocols. These properties are:

  1. Pre-image resistance: It is computationally hard to reverse a hash function i.e. finding the message (input) from a hash (output).
  2. Second pre-image resistance: Given an input message and its hash, it is hard to find a different input message with the same hash.
  3. Collision resistance: It is hard to find two different input messages of any length that result in the same hash.

Finally, a very desirable property of good hash functions is the Avalanche Effect.

Avalanche Effect is the property where a small change in the input results in a significant change in the output, making it statistically indistinguishable from random.

Avalanche Effect: Slightly different inputs result in greatly different outputs

Encryption

In simple terms, encryption is a way of scrambling an input message (plaintext) into a random-looking output (ciphertext) so that only authorized parties can understand the information. Encryption requires the use of a cryptographic key: a set of mathematical values that both the sender and the recipient of an encrypted message agree on.

Encryption: Transforming plaintext into random-looking ciphertext

There are two types of encryption algorithms: Symmetric and Asymmetric.

Symmetric encryption

In symmetric encryption, there is only one key, and all communicating parties use the same (secret) key for both encryption and decryption.

Symmetric Encryption: Both encryption and decryption is done using the same (shared) key

Asymmetric encryption

In asymmetric, or public key, encryption, there are two keys: one key is used for encryption, and a different key is used for decryption. The decryption key is kept private (hence the “private key” name), while the encryption key is shared publicly, for anyone to use (hence the “public key” name).

Asymmetric encryption can be used for either:

Sending a secret message: Sender encrypts a message using the receiver’s public key and then sends it to the receiver. The receiver decrypts the message using its private key.

Asymmetric Encryption: Sending secret messages only decipherable by the intended receiver

Proving ownership (knowledge of) a private key: The sender encrypts a message using its private key (also called signing) and then sends it to the receiver. The receiver decrypts the message using the sender’s public key. This technique is also known as signing and the resulting encrypted message is called “Signature”.

Signatures: Proving ownership of a secret private key

Homomorphic encryption

(Fully) Homomorphic Encryption, the ‘holy grailʼ of cryptography, is a form of encryption that allows arbitrary computations on encrypted data. It’s a form of encryption with an additional evaluation capability for computing over encrypted data without access to the secret key. The result of such a computation remains encrypted.

Homomorphic Encryption: Operations are performed on encrypted data without any knowledge of plaintext or key

In practice, fully homomorphic encryption where all types of arbitrary operations can be done on encrypted data is not possible yet. However, certain operations over homomorphic structures are possible and are being used in practice.

If you want to test out your knowledge of this lesson, try out this quiz!

In the next section, we will refresh the mathematical concepts required to understand ZKPs. Stay tuned!

Hey there, thanks for reading this far. If you liked this article, don’t forget to follow and leave a clap.

I am building Plurality Network, the user context layer on web3. Join our discord to get alpha!

Follow me here, on LinkedIn, on X, or on Farcaster to get the latest blockchain technical content in simple, bite-sized reads.

--

--

Hira Siddiqui
Coinmonks

Blockchain evangelist that writes about how this tech can change the world for the better!