Skip to main content

Let us understand Cryptography in depth

What is Cryptography ?

Cryptography is about constructing and analyzing protocols that prevent third parties or the public from reading private messages. Various aspects of information security such as data confidentiality, data integrity, authentication, and non-repudiation are central to modern cryptography.

What is Cryptography ?

Prior to the modern age, cryptography was effectively synonymous with encryption, the conversion of information from a readable state to apparent nonsense.

Modern cryptography is heavily based on mathematical theory and computer science. Cryptographic algorithms are designed around computational hardness assumptions, making the algorithms hard for adversaries to break.

There exist information-theoretically secure schemes that probably cannot be broken even with unlimited computing power.

 Cryptography also plays a major role in digital rights management and copyright infringement of digital media.

Caesar Cipher

The Caesar Cipher is one of the earliest known and simplest ciphers. It is a type of substitution cipher in which each letter in the plaintext is shifted to a certain number of places down the alphabet. For example, with a shift of 1, A would be replaced by B, B would become C, and so on. The method is named after Julius Caesar, who allegedly used it to communicate with his generals.

Here is a quick example of the encryption and decryption steps involved with the Caesar cipher. The text we will encrypt is "defend the east wall of the castle," with a shift (key) of 1.

Plaintext: "defend the east wall of the castle"

Ciphertext: "efgfoe uif fbtu xbmm pg uif dbtumf"

It is easy to see how each character in the plaintext is shifted up the alphabet. Decryption is just as easy, by using an offset of - 1.

Another example:

Plaintext: "abcdefghijklmnopqrstuvwxyz"

Ciphertext"bcdefghijklmnopqrstuvwxyza"

 It is a different key is used, the cipher alphabet will be shifted a different amount.

Vigenère cipher

The Vigenère cipher is a method to encrypt alphabetic text by using the position of the letter of the input on the key.

The Key is a word decided by the users and is kept secret.

The message cannot be decrypted without the key.

Let's encrypt the word "sololearn" with the key "web".

Word: sololearn

Key: web

Encrypted message: osmwpfwvo

The explanation follows:

w e b w e b w e b

s  o  l  o  l  e  a  r  

w + s = o

e + o = s

b + l = m

w + o = w

e + l = p

b + e = f

w + a = w

e + r = v

b + n = o

 Specials characters are not used is this type of cipher.

Hashing

Hashing means generating value or values from a string of text using a mathematical function.

Hashing is one way to enable security during the process of message transmission when the message is intended for a particular recipient only. A formula generates the hash, which helps to protect the security of the transmission against tampering.

When a user sends a secure message, a hash of the intended message is generated and encrypted and is sent along with the message. When the message is received, the receiver decrypts the hash as well as the message. Then, the receiver creates another hash from the message. If the two hashes are identical when compared, then a secure transmission has occurred. This hashing process ensures that an unauthorized end user does not alter the message.

Here is a small example in Python that encrypts "Hello World" in SHA-1 (Secure Hashing Algorithm)

import hashlib
hash_object = haslib.sha1(b'Hello World')
hex_dig = hash_object.hexidigest()
print(hex_dig)

You will get a long string which is hashed by the SHA-1 algorithm.

 Hashing is used to index and retrieve items in a database because it is easier to find the items using the shortened hashed key then by using the original value.

Hashed Password

When Alice logs into a host computer (or a telephone banking system, or any other type of terminal), how does the host know who she is ? How does the host know she is not Eve trying to falsify. Alice's identity ? Traditionally, passwords solve this problem. Alice enter her passwords, and the host confirms that it is correct. Both Alice and the host know this secret piece of knowledge, and the host requests it from Alice every time she tries to log in.

The host does not need to know the password; the host has to be able to differentiate valid password from invalid password. This is easy with one-way functions. Instead of shorting password, the host stores hashes of the passwords.

Procedure:

  1. Alice sends the host her password.
  2. The host performs a one-way function (hashing) on the password.
  3. The host compares the result of the hashing to the value it previously stored.

Since the host no longer stores a table of everybody's valid passwords, the threat of someone breaking into the host and stealing the password list is mitigated.

 The list of password operated on by hashing is useless because the hash cannot be reversed to recover the password.

Comments

Post a Comment

Popular posts from this blog

Let us understand DevOps

What Will You Learn ? DevOps is a set of practices that combines software development (Dev) and IT operations (Ops) This article will get you started with the fundamentals of DevOps and understanding how to use it in real projects Understanding what DevOps is and why it's needed along with the basic terminologies Getting started with DevOps and understanding its architecture and lifecycle Introduction to Git and it's basic commands Introduction to Docker, Docker container and it's related concepts Getting started with Jenkins and understanding how to integrate it with Github Basics of Selenium and Nagios Who is the target audience ? Students and industry professionals who wish to get hands-on something called DevOps Users who wish to learn how to integrate the processes between software development IT teams and manage various projects Benefits Improved operational support and faster fixes Good processes across IT and teams, including automation Increased team flexibility an

Unraveling the Mysteries of Quantum Computers: A Glimpse into the Future of Computing

In the realm of computer science, the concept of quantum computing stands as a beacon of unprecedented potential. Unlike classical computers that rely on bits to process information in binary form (0s and 1s), quantum computers harness the mind-bending principles of quantum mechanics to manipulate quantum bits or qubits. This revolutionary approach holds the promise of solving complex problems at speeds that traditional computers could only dream of. Let's delve deeper into the enigmatic world of quantum computing. Understanding Quantum Computer: At the heart of quantum computing lies the qubit, the fundamental unit of quantum information. Qubits possess the unique ability to exist in multiple states simultaneously, thanks to a phenomenon called superposition. This allows quantum computers to perform parallel computations on a scale unimaginable with classical computers. Furthermore, quantum computers leverage another principle of quantum mechanics known as entanglement. Entangled

What is Hard Disk? Definition, functions and types.

In this article, you will know what is Hard Disk and what are these types? Hard disks are also often called Disk drive or "Hard Disk Drive (HDD)". Just as a library is required to handle books in the library, the same computer also needs a similar place in which it can store digital data .  Computers use two types of storage devices to store and process digital content (Document, Image, Videos, Software, Operating system, Program). In which Hard Disk is a secondary memory device. It keeps the data stored permanently. Whereas the primary memory device (RAM) serves to process the program of the computer . It is also called temporary memory. Hard Disk is seen as an important component of a computer because no computer will work without it. In this post we will tell you what is a hard disk in a computer ? In which you will get to know a lot about Hard Disk. So let's first know, what is called a hard disk and then we will talk about other aspects of it. What is hard disk