Cryptography For Beginners. Understanding Hacks #1

Cryptography For Beginners. Understanding Hacks #1

In this first compilation, I will go through the basics of Cryptography, Hashing, and Merkle Trees, which is essential to learning more about the workings of Blockchain and hacks.

In my last article, I wrote about the humble beginnings of Blockchain and Bitcoin. How it started with Cryptographer, David Chaum in 1987.

Then, in 1992, Haber, Stornetta, and Dave Bayer incorporated Merkle trees into the design, which improved its efficiency by allowing several document certificates to be collected into one block.

All these were put together to form the first decentralized blockchain conceptualized by a person (or group of people) known as Satoshi Nakamoto in 2008.??

So what is Cryptography? or Cryptography: The origin story.

No alt text provided for this image

According to Wikipedia, Cryptography is the practice and study of techniques for secure communication in the presence of adversarial behavior.

It was first used as a way to protect sensitive information from being intercepted by enemies, and it has since evolved into a vital tool for securing communication in the modern world.

There are some other ancient stories dating back to Ancient Egypt and Greece. But the summary is that somehow somewhere someone discovered an easier way to lie and not get caught. My theory is that someone was cheating on their spouse and wanted to tell someone without telling everyone so they came up with a secret handshake.?

Yeah, a secret handshake. It always starts with the hands. Then along the line, we started using sticks to encrypt things for some reason until the Avengers came. Or is it the Eternals?

Still confused with the whole Marvel timeline.

And that's my origin story for cryptography. It is completely certified by ChatGPT, so best believe it to be accurate.???

Well, whatever history you choose to believe, it is important to note two terms in the definition of Cryptography. Encryption and Decryption.?

Encryption is a process of converting plain information/text into secret text or cipher text. Decryption is the reversal of the process.

The process or system that is used to handle the process of Encryption and Decryption is called Cipher.

A Block cipher is a method of encrypting data in blocks to produce ciphertext using a key and algorithm(Method or style or process of calculating stuff).?

A Block is a group of letters, numbers, or symbols that form a plain text or a cipher text.

In the past Ciphers were easy. My favorite is Caesar's Cipher.?

What is Caesar's Cipher?

No alt text provided for this image
Caesar Cipher

Caesar Cipher is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with a left shift of 3, D would be replaced by A, E would become B, and so on.

That is the plain text or plain text block, WHODUNIT, with a left shift of 3 key will be:

(W is equal to (1st shift = X),(2nd Shift = Y)(3 shift = Z ?? ). (H is equal to (1st shift = I),(2nd Shift = J)(3 shift = K ?? ). And so on till you get a cipher text or a cipher block,

ZKRGXQLW.?

You could choose to go left or right or change the number as your key.

Neat, right? All you just need is the key and the cipher text.

There were other forms of Ciphers like Steganography, Cryptogram, Homophonic Substitutions, the weird stick thing called scytale and many other forms of cryptography native to different people.

No alt text provided for this image
Scytale

But then, we are human beings and we love creating problems for solutions. And with the coming of Computers and the rise of Cryptoanalysis, we decided to do away with the old methods and invent new ones.

Cryptanalysis is the study and process of analyzing and decrypting ciphers, codes, and encrypted text without using the real key. Alternately, we can say it’s the technique of accessing a communication’s plain text content when you don’t have access to the decryption key.

In the early 1970s IBM personnel designed the Data Encryption Standard (DES) algorithm that became the first federal government cryptography standard in the United States

No alt text provided for this image
Data Encryption Standard (DES)

DES is a symmetric-key algorithm, which means it uses the same key to encrypt and decrypt a message, so both the sender and the receiver must know and use the same private key.?

The DES process involves encrypting 16 times. It can run in four different modes, encrypting blocks individually or making each cipher block dependent on all the previous blocks.?

DES has been superseded by the more secure Advanced Encryption Standard (AES) algorithm for reasons of security/safety.

Why is DES unsafe?

For any cipher, the most basic method of attack is brute force, which involves trying each key until you find the right one. The length of the key determines the number of possible keys and hence the feasibility of this type of attack.

The effective DES key length of 56 bits would require a maximum of 256, or about 72 quadrillion, attempts to find the correct key. This is not enough to protect data with DES against brute-force attempts with modern computers.

And with Quantum Computing on the horizon, it will only get far easier for brute force, and that's why some cryptographic system designers are considering developing post-quantum cryptography.

Quantum computing is a method of solving problems that are too large or complex for traditional computers by using laws of quantum mechanics. Quantum theory explains how energy & matter behave at the atomic and subatomic levels. Qubits, or quantum bits, are the fundamental unit of information here - analogous to a binary bit from traditional computing.?

I will touch more on AES and RSA in a later article, but for now, let's quickly look at Hashing and Merkle trees.

So what is Hashing or Hashes?

No alt text provided for this image
Hashing

Hashing is the process of transforming any given key or a string of characters into another value. This is usually represented by a shorter, fixed-length value or key that represents and makes it easier to find or employ the original string.?

Encryption is a two-way function where information is scrambled in such a way that it can be unscrambled later. Hashing is a one-way function where data is mapped to a fixed-length value.

Encryption is meant to protect data in transit, Hashing is meant to verify that a file or piece of data hasn’t been altered.

Hashing is commonly used to authenticate secured data like passwords.

Any function used to transform or map those keys to values is called a Hash Function. Two notable functions that you would hear a lot while working with Blockchain technologies like Ethereum are the SHA-256 and Keccak256.

Crypto Mining utilizes hashing of randomly generated numbers in order to arrive at a specific hashed value containing a series of leading zeroes. This arbitrary function is resource-intensive, making it difficult for a bad actor to overtake the network.?

It is believed that The more hashing (computing) power in the network, the greater its security and its overall resistance to attack.?

What is a Merkle tree?

No alt text provided for this image
Merkle Tree

A Hash tree, also known as a Merkle tree, is a tree in which each leaf node is labeled with the cryptographic hash of a data block, and each non-leaf node is labeled with the cryptographic hash of its child nodes' labels.?

For example, you have four pieces of cloth and the hash of those pieces of cloth form each color Red, Blue, Red, and Yellow respectively. The hash of the first two pieces of cloth which is Red and Blue is combined to form another hash called purple. And hash of the third and fourth pieces of cloth which is Red and Yellow is combined to form the hash, Orange. Then the Purple and Orange are then combined to form some sort of Brown. That Brown is now called the Root Hash and the rest colors are called leaves or leaf nodes.

More articles on Cryptography For Beginners are on the way as we continue to find the path where it all comes together.

要查看或添加评论,请登录

Ral Andrew的更多文章

社区洞察

其他会员也浏览了