1. Home
  2. Explore
  3. Computer Science
  4. Secret-Key Encryption

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Secret-Key Encryption

Transcript

so our topic of discussion today is secret key incretion so before we discuss uh  and describe secret key encryption   so let's first uh explain what is basically encryption encryption is the process of  encoding information so as to protect   it against unauthorized exess right the  encription process encodes the original   information known as plain text to a form  which is called Cipher text so uh if this   is the original information which is  basically plain text this is called

plain text then the encryption process  transforms encodes it to a form which is called Cipher text right so here the process is   this process is encryption the dec  decryption is the reverse of this process if this is the cipher text then the de  decryption process retrieves the original plain text this here is decryption so uh encryption and decryption  both use a key basically we use a key to   encode the information from plain text  to Cipher text and again if you want to

retrieve the Plaine text from the cipher  text we need a key right so uh depending   upon the type of the key we have two  different methods of encryption one is called secret key encryption the other one is called public key encryption right in the secret key  encryption the same key is used for   encryption and decription so that's  why it's also called symmetric key cryptography right while in the  case of public key encryption uh

the key for encryption is not the  same as the key which is used for   decryption both keys are different so  that is why this is also called called asymmetric key cryptography so in this uh discussion  today we are going to explain the   secret key encryption right so let  us do with the help of an example   so for example say we have uh one word  which we need to enip for example say attack so for this we need an encryption  algorithm so uh for this simple example

uh let's use a simple operation at the bit level  which is called X4 exclusive for operation right   so uh for example if we have the truth table for  the XR operation is like this right and this is a   X1 this is the representation for X X or B so  we have four possible combinations 0 0 0 1 1   0 and one one right so uh the output is one only  when both these bits are different right if both   these bits are same the output of this operation  is zero so here it is zero when both bits are the

same here is also zero when both bits are same  both bits are different then here it is one so   this is basically the XR uh uh operation and  the truth table we can use uh this uh simple   operation to demonstrate our example we are  going to use XR as an algorithm for secret   key encrytion right so um for example uh this  word attack let's consider their X SK equivalent

s right American Standard code for information interchange so um this word attack for example  a uh is represented using uh uh 41 hex a is   represented using 41 hex this is a hexad decimal  all right then we have t uh the hexadecimal uh   representation for T is 54x right and Double T  right 54 again again a this is 41 hex and then   C this is represented using 43x and then we have K  which is basically 4 B has these are basically the

S key representations of these alphabets all right  so um let's consider them represent them in binary   you know for example this 41xx is 0 1 0 this is 4  and then this is 0 0 1 this is one all right this   is four and this is 1 and 5 0 1 0 1 and this is 0  1 0 0 so this is 5 and this is four again 0 1 0 1   and this is 0 1 0 0 and then we have 4 1 so this  is 0 1 0 0 4 and then 0 0 0 1 and then we have 43

0 1 0 0 and 0 0 1 1 and then we have four 4 B 0 1  0 0 and then uh B is basically 1 0 1 1 so this is   uh binary representation of this data uh this word  that we need to enip so we need a key for example   uh to enip this information using the secret key  algorithm X that we have chosen so let our key K   be for example 7 3x right so 73 in binary is 0  1 1 1 and 0 0 1 one okay so uh this is our for

example key this is one byte Long Key okay so each  bite of information that we have we can exore that   bite with our key and then we will get an output  so that that output will be our Cipher text so   for example let's put this key here 0 1 1 1 and 0  0 1 1 all right so we XR perform the XR operation   by Bit by Bit on this entire bite so 1 one 1 one  is zero right okay 01 this 0 1 is one so this 0

1 is one when both the bits are different both the  bits are same this is z this is zero both the bits   are different one and one both the bits are same  this is 0o and this again is zero so similarly on   the all the uh all these uh bites we perform the  same operation so let's write this 0 1 1 1 0 0 1 1   here and again here 0 1 1 1 then 0 0 1 1 0 1 1 1 0  0 1 1 uh 0 1 1 1 0 0 1 1 0 1 1 1 0 0 1 1 all right

so let's find out the output after performing  X operation of the plain text with this key so   this first line over here this is the pl PL text  okay this this is our plain text this is plain text and this second is our key right  second line of key okay so again this   0 1 both are different so this is one both  are different this is one this is one 0 0   and one both are same 0 and zero here again  1 1 1 0 0 and uh 1 0 0 right this is T this

is T both are the same the output is the  same so it it's out to be the same same   as here right this is a this is a also so  one one both are same 0o and 1 0 0 1 1 and   this is 0 0 right and then we have one one  which is same then same same same different   one one and this is same same okay and then we  have 0 0 0 1 1 1 0 0 so this is now our Cipher text okay so um uh we can now represent it in in  compact form using the hexadecimal numbers

for example this becomes this is 0 0 1 1 this  is three and this is 0 0 1 02 so this is 32x   and this is 0 0 1 0 so this is basically two  and this is 0 1 one 1 this is 7 this is 2 7x   so this is 0 0 1 0 so this is two and this  is seven right and we have 0 0 1 1 so this   is three and 0 0 1 0 this is 2 right 3 xx and  this is again 3 and 0 and this is 0 0 1 1 and   that is basically three and that is 8 38 so uh 32  hex basically is the SK code for digit 2 and 27

is the SK code for this single comma and this 27  again single comma and this 32 is basically again   here is two and 3 is a the SK code for digit  zero and 38 is the SQ code for 8 so our plain text this was our plain text right it has been transformed using our  XO operation in caption algorithm using   the key 7 3 hex to basically this information  2 comma comma 208 so this is basically Cipher text so anybody looking at this information um  will not have any idea what this is what this

is about all right so um uh if uh one wants to uh  decrypt this information for example the receiving   end so what they can do is use the same key and  perform the same algorithm XR to retrieve this   original information so let's see how we can  do it so for example this is our uh cyer Tex   right in binary okay so uh this is 0 0 1 1 0 0  1 0 right then 0 0 1 0 0 1 1 1 okay and then 0   0 1 0 0 1 1 1 then we have 0 0 1 1 0 0 1 0 then  0 0 1 1 0 0 0 0 and then we have uh 0 0 1 1 1 0

0 0 right so so this is the cipher text and uh  this is the key so let's put down the key here   0 1 1 1 0 0 1 1 right again this key repeat this  key here 0 1 1 1 0 0 1 1 0 1 1 1 0 0 1 1 0 1 1 1   0 0 1 1 0 1 1 1 and 0 0 0 1 1 0 1 1 1 0 0 1 1  right so let's again perform the XR operation   and see the output so uh both these bits are  different so output is one they are same both   these bits are same so 0o and 0o and zero and  this one is 0o 0o this one is one and zero okay

and then this is same 0 0 1 both the bits are  same so 0 both the bits are same both the bits   are different this is 1 0 then 1 0 and 1 0 okay  here we have 0 0 1 0 1 0 1 0 right so this is 1   0 0 0 0 0 0 1 0 all right so this is 1 1 0 0 0  and uh uh this is 1 1 0 and 0o this is 0 this   is zero and this is one this is zero all right  and then we have here 1 1 0 and 1 0 0 1 0 all   right so we see that this here is basically  uh 4 1 this is 4 and this is 1 4 1 hex then

this is five and 4 hex and here we have 54 hex  again and here we have 4 1 hex and here we have 4 3x and here we have uh basically this is  four and this is B 4 B Hax so you see this   information is the same as it was here which is  our plain text so we have retrieved plain text again by performing the same algorithm with  the same key with the cipher text so here we   performed the X operation between the plain  text and the key and got the ciper text and   here we uh performed the XR operation the uh  decryption operation using the same algorithm

XR with the cipher text with the key and retriev  the plain text right so this is basically a t   t a c K right so uh what we have now done is we  have done the reverse operation okay so in other words uh this was the cipher text 2  comma comma 208 and this was a cipher text right and uh this was  the decryption operation

using x r with key K isal 73 hex and we obtained  that plain Tex again attack that is our PL Tex   so this is a very very simple example of uh  encryption and decryption secret key encryption   and decryption uh and and and we use the same  key here for the ition and the same key for   the decryption that is why this is called secret  key encryption and decryption and please keep in   mind that this is only for an example this uh  encryption uh example using XR is very weak uh

encryption because uh the key can be easily  retrieved for example if uh a third party uh   gets access to only a single bite of uh the plain  text and the cipher text and they get a pair for   example the plain text and Cipher text pair of  only a single bite they can retrieve the key for   example consider here so this was our plain text  and this is the cipher text if we you know perform   X or operation of plain text and Cipher text we  can get the key consider this here so for example

this was our plain text 0 1 0 0 then 0 0 0 1 and  the corresponding cyer Tex is this 32 0 0 1 1 0   0 1 0 right so this is plain text this is cipher  Tex so we perform X operation on them so this is   one this is 1 0 0 and this is 1 1 1 0 so note that  this is basically this this was uh uh our plain   text this is 41x plain text right this is 32 hex  32 hex this is cyer Tex right and we get the key

here which is 73x 7 and 3X so um this encryption  example is uh only for uh explaining the secret   key encryption right the Practical encryption  algorithms uh for example FAL Cipher uh structure   uh U which is used for the ention standard digital  uh data encryption standard they used quite longer   Keys okay and here uh we performed bite by bite  encryption which is called basically a stream Cipher see so many algorithms actually  will perform encryption on blocks of text which is which are called block ciphers

right so uh so what I mean to say is  this is only an a simple example and   this is not a very strong encryption  technique the uh actual encryption   algorithms uh they perform differently  and they are quite complex and they use   many many uh longer bits uh for the key  okay so that's it for today thank you

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent