Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
Semantic Security 
3.
One Time Pad
4.
Perfect Secrecy 
5.
Frequently Asked Questions 
5.1.
What are the drawbacks of using One Time Pad? 
5.2.
What is the role of Cryptography in Information Security?
5.3.
Specify some Cryptography tools used frequently in today’s age.
5.4.
What forms of cryptography are used in blockchain?
6.
Conclusion 
Last Updated: Mar 27, 2024

The Partial Information Concerning Plaintext Bits for obtaining the semantic security

Master Python: Predicting weather forecasts
Speaker
Ashwin Goyal
Product Manager @

Introduction

Before starting the discussion, let us first grasp some important concepts to understand things better. In cryptography or Information Security, to secure your information from a third party, many applications use cryptography algorithms to encrypt information or messages. 

For instance, let us say you and your friend Alie are talking to each other via some social application. The information you people are sharing might contain personal information that is not intended to be read by any other person. 

Since Alie is scared of being caught, you people talk in some codes that only you guys know. 

boy and girl

So, by this, if someone tries to read your conversation, he will get confused and, as a result, won’t understand anything. 

Using the same approach, crypto algorithms are made. In simple words, Cryptography is the study of encrypting and decrypting data using mathematics. Cryptography allows you to store sensitive information or send it through insecure networks (such as the Internet). It uses codes to secure information and communications so that only those who are supposed to read and process it may do so.

So, that’s a brief introduction to Cryptography. Today, we will discuss the concepts a little more advanced and in-depth. Before we start, let us understand the meaning of today’s topic. 

plaintext bits

The Partial Information Concerning Plaintext Bits for obtaining semantic security.

To understand the topic, we must know the keywords in it. We will start with semantic security. 

So, what is security in general?

Security refers to both safety and the precautions taken to protect oneself. Here, what to secure? The information is shared over the public Internet, where hackers sit in the middle of the conversation to steal confidential data. Security is important everywhere. Due to the evolution of the Internet, everything is converging to Digital, which has its advantages and disadvantages. To protect the information from adversaries, we need to have high security over the data. 

How do we protect our data from third parties by using cryptography? 

Let us understand it:

Cryptography is closely related to encryption, converting plain text into ciphertext before sending it and then back again after receiving it.

cryptography

Now, let us discuss what Semantic Security is.

Semantic Security 

Cryptography can be powerful or weak. The time and resources required to retrieve the plaintext are used to determine cryptographic strength. Strong cryptography produces ciphertext that is extremely difficult to decode without the proper decoding software. It is impossible to decrypt the output of strong cryptography until the end of the universe, even with all of today's computing power and available time—even a billion computers performing a billion checks every second.

So, a semantically secure cryptosystem in cryptography is one in which only negligible information about the plaintext can realistically be extracted from the ciphertext.

Now, a question may arise: How can some data be extracted from the ciphertext that can be used to decrypt the ciphertext into plaintext? 

recalling

For example, we change every byte to encrypt an image. We either change the last bit or the last two bits. Every byte is 8 bits; we change the last two bits in the hope that no one will notice. So, for every byte( 8 bits), six are the regular image, and two are our secret message. 

So, if we have a normal pixel, it will be 4 bytes long. 

So, for each byte, we are talking about the last two digits mentioned below: 

pixel

What are the possibilities of changing the last two bits? Since we only have 1 and 0 in a byte, we can toggle the bits or leave them both the same based on the message we have. 

For example, the secret message is 100100. 

So, we don't have to do anything to hide the initial two bits in the pixel. 

pixel

To hide the next two bits of the secret message, we use another byte of a pixel. To hide the next two bits of the secret message, we use another byte of a pixel. So, let us say the next byte is 0 1 1 0 1 1 1 1. 

pixel

So, by changing that second least significant bit from 1 to 0, we can hide the secret message. In a huge image - changing by two levels is probably not noticeable. 

stegnographic image

The above image is about 3 megapixels in size. You will see little detail when you only change the last two significant bits of an 8 bits channel image. 

But, if you do the subtraction on the images, you can see a difference. 

semantic security

Although, in general, it’s going to be pretty imperceptible. We understood from the example above that an adversary could extract the hidden message from the image. Hence, it is not semantically secure

In cryptography, we have three classical cipher techniques. The Caesar cipher, the vigenere cipher, and the enigma machine. Each of these cipher techniques leaks information. For example, the Caesar cipher leaks information about the frequency of plaintext letters because that information is preserved in the ciphertext. On the other hand, the vigenere cipher also leaks information because the message is typically much longer than the key, and the key is applied to the message by repeating itself repeatedly. The enigma machine leaks information about what isn’t the plaintext. 

Is it even possible to build a cipher that leaks no information? 

question

That’s what we are going to learn today. So, the answer to this question is Yes.

We can achieve this by using a One-time Pad

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

One Time Pad

As we have discussed above, in the vigenere cipher, repeating keywords results in security leakage as the code can easily be broken. The one-time pad is an improvement to the vigenere cipher.  The main difference is that in the vigenere cipher, the keyword repeats, whereas, in the one-time pad, the keyword is not allowed to be repeated. Moreover, the keyword used in the One-time pad is truly random. So, the one-time pad yields the ultimate security. This is not it; in a one-time pad, there is a Random key that is as long as the message. Not only this, as the name suggests, the key is to be used to encrypt and decrypt a single message and then discarded

Each new message requires a new key of the same length as the new message. 

one time pad

That’s the functionality of the One-Time Pad that makes it semantically secure. 

Characteristics of One Time Pad:

  • One Time Pad produces Random Output: The plaintext is there, the random key is used, thus, the output produced will also be random. That means, the cipher text will be Random. 
    So, when the attacker receives the ciphertext, also if he has guessed the key the output will be random all the time. We can say that the security of the One Time pad is entirely due to the randomness of the key. 
     
  • Code is unbreakable: There exists no statistical relationship to the plaintext as the cipher text contains no information whatsoever about the plaintext, there is simply no way to break the code. So far, the One Time pad offers the best security among all other substitution cipher techniques. 
     

As we have discussed semantic security in cryptography, the mechanism that adheres to the same is considered in the category of Perfect Secrecy

Perfect Secrecy 

The one-time pad is the only crypto mechanism that exhibits what is referred to as perfect secrecy. 

Perfect Secrecy

Perfect secrecy is the notion that, given an encrypted message( or cipher text) from a perfectly secure encryption system( or cipher), absolutely nothing will be revealed about the unencrypted message( or plaintext) by the ciphertext. 

Now, let us see some faqs based on the discussion above: 

Frequently Asked Questions 

What are the drawbacks of using One Time Pad? 

There are two fundamental difficulties while using One Time Pad: The practical problem of making large quantities of random keys. Even more daunting is key distribution and key protection. 

What is the role of Cryptography in Information Security?

Cryptography safeguards data availability, ensures data integrity, ensures the right sender or receiver, and protects information confidentiality.

Specify some Cryptography tools used frequently in today’s age.

Security Token, JCA, SignTool.exe, CertMgr.exe, and Docker are some of the most widely used cryptography tools.

What forms of cryptography are used in blockchain?

Asymmetric-key algorithms and hash functions are the two cryptographic algorithms used in blockchains.

Conclusion 

To conclude, we have extensively discussed the Partial Information Concerning Plaintext Bits for obtaining semantic security in Cryptography. We also went through the one-time pad and its characteristics. If you like this article and want to learn more about Cryptography, please refer to these articles and enhance your knowledge.

You can also refer to our Guided Path on Coding Ninjas Studio to upskill yourself in Data Structures and AlgorithmsCompetitive ProgrammingSystem Design, and many more!

Head to our practice platform, Coding Ninjas Studio, to practise top problems, attempt mock tests, read interview experiences and interview bundles, follow guided paths for placement preparations, and much more.

Happy learning, ninja!

Previous article
Monte Carlo Simulation
Next article
Hello! I am ElGamal Cryptosystem
Live masterclass