Blockchain Tutorial

Blockchain Tutorial History of Blockchain Blockchain Terminologies Working of Blockchain Blockchain vs DLT Blockchain Versions Smart Contracts Blockchain Applications Cryptography Role of Bitcoin Miners Blockchain Hash Function Bitcoin Basic Component Blockchain Block Hashing How to Block Hashes Work in Blockchain Blockchain Pow Coinbase Transaction Key Concepts in Bitcoin Key Areas of Blockchain Blockchain Cryptocurrency Blockchain DAO Blockchain Double Spending Blockchain Bitcoin Cash Bitcoin Forks and SegWit Blockchain Merkle Tree Difference between Blockchain and Database Bitcoin Mitigating Attacks Who sets the Bitcoin Price Getting Started with Bitcoin How to choose Bitcoin Wallet Sending and Receiving Bitcoin Converting Bitcoins to Fiat Currency Ethereum 2.0 Blockchain Data Management Steps to become a Blockchain developer Smart Contracts Advantages of Blockchain in healthcare Decentralized Voting System using Blockchain Demur-rage currencies in Blockchain How can Blockchain Technology help IoT to reach its full potential Project Ideas on Blockchain for Professionals Consensus Algorithms in Blockchain Top 10 Blockchain Project Concepts Uses of Blockchain Obtaining Free Test Ethers What does a Blockchain contain What does the IT industry mean by BaaS Top Blockchain Project Ideas for Beginners

Cryptography

Introduction and Features of Cryptography DNA cryptography ECB Mode in Cryptography Elliptic curve in cryptography Format String Vulnerabilities in Cryptography and Network Security Kerberos in Cryptography and Network Security Blowfish Algorithm in Cryptography Data Encryption Standards Feistel Cipher in Cryptography HMAC Algorithm in Cryptography IP Security in Cryptography ElGamal Algorithm ElGamal Cryptosystem What is IDEA Advantages of Cryptography Role of Bitcoin Miners Blockchain Hash Function Blockchain Merkle Tree Blockchain Pow Coinbase Transactions Consensus Algorithms in Blockchain Converting Bitcoins to Fiat Currency Decentralized Voting System using Blockchain Demur-rage currencies in Blockchain Difference between Blockchain and Database Difference between Symmetric and Asymmetric Encryption Ethereum 2.0 Getting Started With Bitcoin How can Blockchain Technology help IoT to reach its full potential? How does Digital Signature Work Advantages of Blockchain in healthcare Basic Component of Bitcoin Bitcoin Forks and SegWit Bitcoin Mitigating Attacks Blockchain Bitcoin Cash Blockchain Block Hashing Blockchain Cryptocurrency Blockchain DAO Blockchain Data Management Blockchain Double Spending What does Blockchain contain? What does the IT industry mean by BaaS (Blockchain as a Service)? Who sets the Bitcoin Price? Working of Block Hashes in Blockchain How to Choose Bitcoin Wallet? Key Areas of Blockchain Key Concepts in Bitcoin Obtaining Free Test Ethers for the Rinkeby Test Network on the Ethereum Blockchain Project Ideas on Blockchain for Professionals Sending and Receiving Bitcoin Top 10 Blockchain Project Concepts Uses of Blockchain What do you need to do to become a Blockchain Developer? Blockchain Technology-Introduction

Feistel Cipher in Cryptography

What is Feistel Cipher?

A Feistel Cipher is a structural model that is used to build various symmetric block Ciphers similar to DES. This structural model can be self in veritable. The Feistel Cipher algorithm follows the technique of standard encryption and decryption algorithm. The Feistel Cipher algorithm is based on the Shannon structure that was proposed in the year of 1945. The Feistel Cipher algorithm demonstrates the confusion and diffusion encryption process. It is possible with the help of a substitution algorithm. The diffusion encryption process makes a complex relationship between plain text and Ciphertext. This diffusion process follows a permutation algorithm. The Feistel Cipher follows the implementation process of substitution and permutation algorithm. Substitution replaces the plain text with the Ciphertext. 

Example of the Feistel Cipher

The Feistel Cipher algorithm involves various steps for processing plain text. Each round involves two processes, including the permutation step and substitution step. This encryption process involves the following steps. 

Steps 1:

In the first step of the encryption process, the plain text is divided into different blocks. And only one block process one time only. The encryption process consists of plain text and a key. 

Step 2:

The plain text is divided into two steps. The left part of the plain text is represented as LEO, and the right part of the plain text is known as REO. Both parts of the plain text (LEO and REO) undergo the process of conversion of plain text to Ciphertext block. 

For every encryption process, the encryption process is applied to the REO of the plain text, which has a key known as Ki. This encryption process results in the XORed of the LEO of the plain text. XOR is a logical operation used in cryptography for encryption and decryption. After that, this XOR function results in a new right half of the plain text. The last right half becomes the new right half of the plain text. Every round of this cryptography follows the same steps. In every step, the substitution function implements the round part of the right-hand side of the plain text. 

Features of Feistel Cipher

There are some features that are used in the Feistel Cipher. These are as follows.

1. Block size

When the size of the block is large, then the Cipher block is more secure. Because when the size of the block is large, then the execution speed of encryption and decryption increases. 

2. Easy analysis

With the help of the Feistel Cipher, it is straightforward to analyze the weakness of any cryptographic algorithm. 

3. Number of rounds

The number of process rounds can impact the security of the Cipher block. When the number of games increases, then the security level also increases. So the decryption process is going to be more complicated. 

4. Round function

With the help of the complex round function, we can boost the security level of the block Cipher.

Python code:

import binascii
def rand_key(p): 
import random
key1 = ""
p = int(p)
for i in range(p):                                                          
temp = random.randint(0,1)      
temp = str(temp)                                                             
key1 = key1 + temp                                                          
 return(key1) 
def exor(a,b):                                                               
temp = ""
for i in range(n):
if (a[i] == b[i]):
temp += "0"                                                                        
else:                                                                             
temp += "1"
return temp
def BinaryToDecimal(binary):
string = int(binary, 2)
return string
PT = "Hello"
print("Plain Text is:", PT)
 
            PT_Ascii = [ord(x) for x in PT]
PT_Bin = [format(y,'08b') for y in PT_Ascii]
PT_Bin = "".join(PT_Bin)
 
n = int(len(PT_Bin)//2)
L1 = PT_Bin[0:n]
R1 = PT_Bin[n::]
m = len(R1)
 
K1= rand_key(m)
 
K2= rand_key(m)
 
f1 = exor(R1,K1)
R2 = exor(f1,L1)
L2 = R1
 
f2 = exor(R2,K2)
R3 = exor(f2,L2)
L3 = R2
bin_data = L3 + R3
str_data =' '
for i in range(0, len(bin_data), 7):                                        
temp_data = bin_data[i:i + 7]                                                
decimal_data = BinaryToDecimal(temp_data)                                    
str_data = str_data + chr(decimal_data)                                                                  
print("Cipher Text:", str_data)
L4 = L3
R4 = R3
f3 = exor(L4,K2)
L5 = exor(R4,f3)
R5 = L4
f4 = exor(L5,K1)
L6 = exor(R5,f4)
R6 = L5
PT1 = L6+R6
PT1 = int(PT1, 2)
RPT = binascii.unhexlify( '%x'% PT1)
print("Retrieved Plain Text is: ", RPT)

Output:

Feistel Cipher in Cryptography

Conclusion

The Feistel Cipher is a well-known cryptography design model that organizations can use to help secure their sensitive data. Even if a hacker knows the Cipher algorithm, a strong encryption Cipher should prevent the criminal from deciphering the Cipher plain text without having the key or sets of keys. In addition to this Cipher model, businesses should adopt a layered cybersecurity strategy to help prevent threat actors from stealing or exposing their sensitive information.