The Binary Numbering System (base-2)

Every machine is an electronic system. in order to communicate with machines, the best way is to via electrical signals. Every electronic machine has a minimum of two signals i.e. “positive” and “negative”. Considering this as fundamental principles computers used binary to build their systems The Binary Numbering System is the most fundamental numbering system in all digital and computer-based systems. a binary number is … Continue reading The Binary Numbering System (base-2)

MD5 – Message-Digest Algorithm

The MD5 hashing algorithm is a one-way cryptographic function that accepts a message of any length as input and returns as output a fixed-length encrypted value further used for authentication. As it is hash function so it is irreversible. MD5 hash function is severely compromised, MD5 is not collision-resistant. The weaknesses of MD5 have been exploited in the field, most infamously by the Flame malware … Continue reading MD5 – Message-Digest Algorithm

Diffie Hellman Key Exchange

In early 70’s to send a secret message, both parties (sender and receiver) have to exchange the key to encrypt and decrypt the message. Exchange secret key may lead to compromising the security, as while exchange this key if someone intercepted secret key then the interceptor can decrypt all messages. This problem is called the key exchange problem in computer science  The key exchange problem … Continue reading Diffie Hellman Key Exchange

Modular Exponentiation

Modular Exponentiation as also known as repeated sequence algorithm which performs exponentiation over modulus. Which essential in computer cryptosystems. A typical problem related to cryptography involves exponentials with a very large number e.g. 36078267  mod 17. To perform these very large number calculation we need an efficient approach. The approach should be a time-efficient and memory-efficient approach. As directly calculating (36078 * 267 mod 17) … Continue reading Modular Exponentiation

Insertion Sort Algorithm

Insertion sort is a simple sorting algorithm which work mechanism in which sorted array is built having one item at a time.  The array elements are compared with each other sequentially Upon each iteration, an item is taken from the list and inserted into the correct position by comparison with next elements of an array. This process is repeated until we reach the last item … Continue reading Insertion Sort Algorithm

Selection Sort Algorithm

Selection sort is a simple sorting algorithm. Divide the array into two arrays, sorted and unsorted. Then   selects the smallest element from an unsorted list in each iteration and places that element at the sorted array one by one. This process continues moving unsorted array boundary by one element to the sorted array. Let’s consider an array with values { 12, 4, 45, 2, … Continue reading Selection Sort Algorithm

Quick Sort Algorithm

Quicksort is an algorithm use divide and conquer approach in which the array is split into subarrays by selecting value from array as pivot and then the sub-arrays are recursively called to sort the elements. Steps for quick sort are 1. Pick an element from an array called a pivot. (Different versions of Quicksort pick pivot in different ways) 2. Partitioning- Divide the array into two … Continue reading Quick Sort Algorithm

Bubble Sort algorithm

Bubble Sort is the simplest sorting algorithm that works by iterating through the array from the first index to the last index and comparing adjacent elements and then swapping them if they appear in the wrong order. I.e. If the next element is smaller than the current element, they are swapped.  As it iterates for all the array elements with repeatedly swapping the adjacent elements. … Continue reading Bubble Sort algorithm


Cryptography – Mixture of Art and science

Being human, we always concern about our privacy. Privacy plays a significant role in our lives, right from starting on the day till the end of the day. As part of privacy, we want our data, message to be secure. A common example is when we send a text message mostly expecting that only intended recipients should receive it. So being intelligent, human started manipulating … Continue reading Cryptography – Mixture of Art and science

Deep Dive in RC4 (RC4 Source Code in C#)

RC4 (Rivest Cipher 4) was designed by Ron Rivest. It is remarkable for its speed and simplicity. It widely used in many applications and protocols. Though, there are multiple Vulnerability has been discovered in RC4.  It is a stream cipher type. It encrypt/decrypt input data one by one. In this way, the encryption or decryption can be implemented on the length of the variable. This algorithm does not … Continue reading Deep Dive in RC4 (RC4 Source Code in C#)

eXtended Tiny Encryption Algorithm (XTEA) – PART II

In this article, we will demonstrate eXtended Tiny Encryption Algorithm (XTEA). Don’t forget to read the Part I of TEA. XTEA (eXtended TEA) is a block cipher designed to fix weaknesses in TEA. Like TEA, XTEA is a 64-bit block Feistel cipher with a 128-bit key and a suggested 64 rounds. As per book “Information Security and Cryptology – ICISC 2003“ TEA is a 64-round … Continue reading eXtended Tiny Encryption Algorithm (XTEA) – PART II

Cryptography - Tiny Encryption Algorithm, TEA

Tiny Encryption Algorithm (TEA)- Part I

 Tiny Encryption Algorithm is a simple, powerful & notably fast encryption algorithm. Although TEA algorithm has a few weaknesses as it suffers from equivalent keys (Which left the room for related-key attacks) – each key is equivalent to three others, which means that the effective key size is only 126. It is Feistel type cipher, the algorithm relies on the alternate use of XOR and ADD … Continue reading Tiny Encryption Algorithm (TEA)- Part I

Deterministic Algorithm

A deterministic algorithm is an Algorithm in which for a given input, the computer will always produce the same output by going through the same states that also means for given the same input, it will take the same amount of time/memory/resources every time it run. In other words, I would say A deterministic algorithm is simply an algorithm that has a predefined output. For instance, … Continue reading Deterministic Algorithm

Symmetric encryption Cryptography

Symmetric Cryptography

This is the simplest kind of Cryptography that involves only one secret key to encrypt and decrypt information. It is also known as “Secret Key Cryptography”.   Both Sender and receiver should know the key to be able to communicate securely.   For Example: if Mahesh & Shalini wants to communicate using symmetric-key cryptography then both would have to devise key and use it for … Continue reading Symmetric Cryptography

asymmetric cryptography

Asymmetric Cryptography (Public Key Cryptography) – Part I

Asymmetric cryptography, also known as public key cryptography, it uses two distinct, yet related keys. One key, the Public Key, is used for encryption and the other, the Private Key, is for decryption. Let say Mahesh wants to send an encrypted message to Shalini, Mahesh will look for Shalini Public key and use it for encrypt the message before sending it. Then Shalini Can decrypt … Continue reading Asymmetric Cryptography (Public Key Cryptography) – Part I

types of cryptography

Basic of Cryptography (Type of Cryptography)- Part II

Cryptography categorized based on number of keys used for encryption and decryption; Below are list of cryptography catgories  Secret Key Cryptography – It is also call symmetric encryption where for both encryption and decryption uses same key. This is mainly used for confidentiality. Public Key Cryptography – It is also called asymmetric encryption; this algorithm uses two key’s one for encryption and one for decryption. … Continue reading Basic of Cryptography (Type of Cryptography)- Part II

Break caesar-cipher with brute force attack

Caesar Cipher (Cracking Caesar Cipher with the Brute-Force Technique) – Part II

In Part I, I have written code to encrypt the plain text for demonstration purpose . In this article we will use Brute Force technique to decrypt the encrypted message. Note: please make sure to read articles Brute force and Caesar Cipher before this article. Here is C# Code snippet for the same Above code produce below  result, the above code took 17 iteration  to get the actual … Continue reading Caesar Cipher (Cracking Caesar Cipher with the Brute-Force Technique) – Part II

Caeser Cipher in source code in C#

Caesar Cipher Source Code – Part I

The Caesar cipher is one of the earliest known and simplest ciphers; Created and used in 44 BC by Julius Caesar. It is a type of substitution cipher in which each letter in the plain text is ‘shifted’ with certain number of places in the alphabet. For example, if we right shift the alphabets by 3 char then we get the below text;     … Continue reading Caesar Cipher Source Code – Part I

Brute Force

Brute Force – Part I

Brute force is a straight forward strategy to solving a problem, it’s also called as ‘Exhaustive Search’ in which you try all possibilities to reach solution of a problem. In Brute force attack, attacker systematically checks all possible passwords and passphrases until the correct one is found. Alternatively, the attacker can attempt to guess the key, which is typically created from the password using a key … Continue reading Brute Force – Part I

SHA-256(Source Code in C# using .Net in-built Cryptography library) – Part II

.Net Framework provides in built support for various hash functions like MD-5, SHA-1, SHA-256 etc…   ComputeHash method Computes the hash value to the specified byte array.   Below are the overloaded methods to Compute Hash using SHA-256 class in System.Security.Cryptography  library     Here is C# source code using .Net In-build library Continue reading SHA-256(Source Code in C# using .Net in-built Cryptography library) – Part II

SHA-256(Source Code in C#) – Part I

SHA-256 (Secure Hash Algorithm), is one of the cryptographic hash function, commonly used in Blockchain. It generates an almost-unique 256-bit (32-byte) signature for a text.  SHA-256 is successor hash functions to SHA-1. it is one of the strongest hash functions available and has not yet been compromised in any way.   Here is source code written in C#. I will try to give more details in next … Continue reading SHA-256(Source Code in C#) – Part I

Cryptography Hashing

What do you mean by Hashing?

Hashing is process of converting any size of data into fix size of data by performing mathematical operations. A message to be hashed is called input; the Algorithm is used to do so is called hash function; the output is called hash value.   There are many algorithm which used to generate hash value like MD5, SHA-1, SHA-256, Tiger etc.    Hash function generates a … Continue reading What do you mean by Hashing?

basic of cryptography

Basic of Cryptography – Part I

Cryptograph means secret writing, in order to make information secret we use cipher, an algorithm that converts plain text to cipher-text. Cipher has been used long before computer existance. In 44 BC Julius Caesar uses the technique now called Caeser Cipher to send message. He used to shfit the letter by 3 character.  Another great example from history, Nazis Enigma Machine used during war to translate message. … Continue reading Basic of Cryptography – Part I