Lesson finished
Unlock all 22 lessons of Cryptography Basics & ImplementationFull course ₹40,000 · paid
Symmetric Key Cryptography: Shared Keys and Stream Cipher Basics
A free lesson from Skill-Lync's Cryptography Basics & Implementation course, on Grow by Skill-Lync · Last updated 16 Nov 2026 · Session: “Week 2 Session 1 Part 1”
What will you learn in this free Cryptography Basics & Implementation lesson?
Recaps week one, then introduces symmetric cryptography where one shared key both encrypts and decrypts. Explains plaintext, ciphertext and the weaknesses of key sharing, then starts a stream cipher that swaps array values and XORs key bytes.
- Recap of cryptography origins and classical ciphers
- Same key for encryption and decryption
- Plaintext, encryption algorithm and ciphertext flow
- Pseudo-random key stream generation with XOR
What comes after lesson 3?
Later in Skill-Lync's Cryptography Basics & Implementation course (paid): lesson 4, Week 2 Session 1 Part 2; lesson 5, Week 2 Session 2 Part 1; lesson 6, Week 2 Session 2 Part 2. The full course has 22 lessons (11 h 10 min of video); see the course overview or its price and syllabus.
Lesson transcript
Machine transcript of the lesson audio (lightly cleaned). Technical terms may contain errors; the video is the reference.
Hi, welcome to the second week of cryptography, basics and implementation. In this week, we are about to see what is in symmetric cryptography is all about. So, before entering into this week's topic, let's have a small recap of which we saw on the previous slide. So, in week one, we saw what is in cryptography. So, the cryptography is a technique of securing the information and communications through the use of code, so that only those person for whom the information is intended can understand and process it. Thus, preventing the unauthorized access to information will be conveyed in the first place.
So, in the term cryptography means the prefix script means hidden and the suffix graphy means writing. And then we saw about origin of cryptography. So, there are multiple stages which we were discussing about where this cryptography came. So, the earliest stage, they have been using the method called as hieroglyphs. So, hieroglyphs is a character used in the system of pictorial writing, particularly that form used on ancient Egyptian monuments. So, hieroglyphs symbols may represent the object that they, but usually stand for a particular sounds or group of sounds.
So, this hieroglyph meaning a sick carving. So, it is a Greek translation of the Egyptian phrase, the God's words. which was used at the time of early Greek contacts in Egypt to distinguish the older hieroglyphs from the handwriting on the day-to-day. And then we saw about the skytale. So, a skytale is a stick or a piece of wood around where a ribbon or a leather is wrapped and on which a message is written. When the ribbon is just unrolled, an encrypted message appears. That is, the order of the letters will have been changed, obviously.
So, that is the skytale, which we have looked upon. And then we saw about the Enigma. So, the Enigma mission is a cipher device developed and used in the early to mid 20th century to protect the commercial, diplomatic and military communication. So, it was employed extensively by the Nazi Germany during the World War II in all branches of the German military. So, the Enigma mission was considered so secure that it was used to encipher the most top secret messages. And then we saw about the evolution of the cryptography. We saw even many examples on that.
So, I will be explaining few of the points in which we have discussed on the last slide. So, the first one is about the stignography. So, stignography is a technique of hiding a secret data within an ordinary non-secret file or a message in order to avoid the detection. The secret data is then extracted at its destination. The use of stignography can be combined with encryption as an extra step for hiding or protecting the data. The word stignography is derived from the Greek word stignos. That is, which means it is being hidden or covered.
And the Greek means wrote, there's been graph, which is meant to write. So, that is what we have been calling as a stignography. And then we saw about the mono-alphabetic cipher. So, the mono-alphabetic cipher is any cipher in which the letters of the plain text are mapped to cipher text letters based on a single alphabetic key. So, the examples of mono-alphabetic ciphers would include the Caesar cipher or Caesar shift cipher, where each letter is shifted based on a numerical key. And the ALBAS cipher, where each letter is mapped to the letters symmetric to the center of the alphabets.
And then we saw about the poly-alphabetic cipher. So, the poly-alphabetic cipher is any cipher based on substitution using multiple substitution alphabets. So, the Wiviniger cipher is probably the best known example of a poly-alphabetic cipher. So, it is a simplified special case. And then we saw about an ALT-BAS cipher. So, the ALT-BAS cipher is really simple substitution cipher that is sometimes called as a mirror code. It is believed to be the first cipher ever used and it uses pre-day Egyptians, where examples of an encryption. So, to use ALT-BAS you simply reserve the alphabet.
So, A encode to Z and B to Y and just so on. And then we saw about many examples of Caesar cipher, Wiviniger cipher, Translation cipher and Playphrase cipher. So, these are the ciphers which we have been using and this is how it has been evaluated on the recent days. And then we saw about the mathematics behind this kind of cryptography and it is all about the matrix. So, we just saw how the matrix is being implemented and how it is being used on the PR time.
And then what are the ways of algorithms that we have been using with the help of the matrix. So, these are all the points which we have covered on the previous. So, let's see about a table of contents in which we are about to see in this week. So, we are going to see what is in cryptographic primitives and then what are the types of cryptography that we are going to use and we are using in our day-to-day day. And then we are going to see what is a symmetric cryptography or a secret key encryption.
And then we are going to see what are the types of cryptography that we have. And then what is this team ciphers and what are the various types that we have. And what is the block ciphers and what are the various types that we have. And what are the block ciphers mode of operation that are being used in this cryptography. So at the end of the slide, you will be trying to understand what are the importance and what is the need of this cryptography that is specifically on the symmetric cryptography and you will be getting the more information about what is the major usage of this symmetric cryptography and then you got to understand the various types of implementation of stream and block ciphers in the symmetric cryptography.
So let's see the cryptographic primitives. So the cryptographic primitives are well known low level cryptographic algorithm that are used to make cryptographic protocols for just for the computer security. So the cryptographic primitives are building blocks of a cryptographic system that are designed to do tasks in a precise and reliable way. So the cryptographic primitive is a low level algorithm used to build a cryptographic protocol for a security system. It is used by a cryptographic designers as their most basic building block. So these building blocks are a part of a crypto system which is a suit of an cryptographic algorithm needed to implement a particular security service such as encryption functions or one-way hash functions.
Because these primitives are building blocks. Because these primitives are building blocks, they are designed to do one precisely defined and highly reliable task. So creating and testing a primitive to be reliable takes a long time and it is very hard. So designing a new cryptographic primitive to suit the needs of a new cryptographic system is very rare. In this way, cryptographic primitives are similar to programming languages. It is rare that a programmer will invent a new programming languages while writing a new program itself. So instead, they will use an extensive, I mean, they will be using an existing language just as cryptographic designer will use an existing primitive to avoid the time consuming and error prone work on the creating a new kind of primitive.
So this is what all about cryptographic primitives. And then the commonly used cryptographic primitives are secret key encryption, public key encryption, digital signatures and the hash value. So let's see more bit detailed about what are the commonly used kind of cryptographic primitives. So there are other kind of functions where we could mention about the one-way hash function, like an example of mathematical function that takes a variable length, input string and converts into a fixed length binary seed. And then we could even see about this symmetric cryptography. So an encryption system in which the sender and the receiver of a message share a single common key that is used to encrypt a decrypted message and public key cryptography, also known as a asymmetric cryptography, a system that uses a pair of keys of a public key.
So any person can encrypt a message using the receiver's public key, but that encrypted message can only be decrypted with the receiver's private key and then the mixed network as a routing protocol that creates hard to trace communication. So a chain of proxy servers encrypted using public key cryptography are used to take in messages from multiple senders, shuffle them, then send them back in random order to the next destination. And then there are some digital signatures too. So that is to confirm the author of the message. So who created and send that message from where we received it all about. So that is about the digital signature and then private information retrieval.
So there is a protocol that allows a client to retrieve a database information without the owner of the database knowing that specific information was to retrieve. And then the last point is about the commitments. So this allows one to commit to a chosen value while keeping in hidden others with the ability to reveal it later. So these are all the commonly used cryptographic primitive that we have been using all about. Let's see what are all the types of cryptography that we have. So basically there are two kinds of cryptography. One is symmetric and then the next one is about the asymmetric cryptography.
So in this slide, let's see what are the symmetric cryptography or a secret key encryption is all about. So the secret key encryption. So the secret key encryption algorithm used one secret key to encrypt and decrypt data. And then we must secure the key from access by unidentified agents as anybody that has the key and they can use it to decrypt or encrypt the data. The same key is used for encryption and decryption and secret key encryption is also referred to as symmetric encryption. Let's get more into media about the secret key encryption.
So this symmetric cryptography also known as a secret key cryptography, it is used of a single shared secret to share an encrypted data. Between the parties. So the ciphers in this category are called symmetric because you use the same key to encrypt and to decrypt the data. In simple terms, the sender encrypts the data using a password and the recipient must know the password to access the data. So the symmetric encryption is a two-way process. With a block of plain text and a given key, symmetric ciphers will always produce the same ciphertext. Likewise, using the same key on the block of ciphertext will always produce the original plain text.
Symmetric encryption is useful for protecting the data between the parties with an established shared key and is also frequently used to store confidential data. For example, ASP.NET uses 3DES to encrypt the data for a forms authentication ticket. So the well-known hidden key cryptographic algorithms include data encryption standard that is DES and triple strong DES that is 3DES and then reverse cipher2 that is RC2 and then reverse cipher4. So we are going to see these kind of cipher4. So we are going to see these kind of examples on the upcoming slides. And then what is the purpose of the symmetric encryption in the first place? So while symmetric encryption is an older kind of encryption, it is faster and more efficient than an asymmetric encryption, which strains network data capacity limitations and excessive CPU usage.
Symmetric cryptography is used for a bulk encryption or decryption of massive volumes of data such as database encryption due to a superior performance and speed that is relative to an asymmetric encryption. So in the case of database, the secret key may be used to encrypt or decrypt data exclusively by the database. So the following are some examples where the symmetric cryptography is being used. So the payment applications such as card transaction requires the protection of personally identifiable information that is PII. That is to prevent the identity theft and fraudulent charges. And then the validations to ensure that the message center is who he saves he's and then hashing or generating a random numbers.
So what are the factors that affect a symmetric encryption algorithm strength? So not all symmetric algorithms are made equal as you will quickly discover. They differ in terms of strength, but what does cryptography entail? So the basic answer is that cryptographic strength refers to how difficult it is for a hacker to decrypt the data and access it. Of course, the longer answer varies based on the type of algorithm that you are evaluating. And cryptographic strength, on the other hand, usually boils down to a few fundamental characteristics.
That is the symmetric key length, randomness and unpredictability. The algorithm's ability to resist or endure the known attacks and there are no backdoors or any kind of intentional flaws. The symmetric encryption is delicate balancing act since it is necessities, algorithms and keys that are computationally difficult and practicable to utilize with acceptable performance. So this is what we are defining about the secret key encryption. So let's see what are the advantages of the secret key encryption. So the secret key encryption algorithm encrypts and decrypts any kind of block of data swiftly with the best efficiency.
And the encryption that requires at hardware level, that preferable choice would be the secret key encryption. So let's see what are the other kind of advantages that we have over this symmetric algorithm. So the first point is, it is exceptionally safe. So symmetric key encryption can be highly secure when it employs a secure algorithm. As recognized by the US government, the advanced encryption standard is one of the most extensively used symmetric key encryption schemes, that is AES. So using 10 petaflop machines, brute force guessing the key, using its most secure 256 bit key length and would take about a billion years.
Because the world's fastest computer as of this current year is running at 17 petaflop, that is 256 bit AES is virtually impenetratable. And then the next one is about the speed. So one of the disadvantages of this public key encryption method, it requires very complex mathematics to function, making the computationally intensive. It's pretty simple to encrypt and decrypt the symmetric key data, resulting in excellent reading and writing performance. Many kind of solid state drives, which usually are pretty fast, use symmetric key encryption to store data inside.
Yet they are still quicker than traditional hard drives that are not even encrypted. And then the next point is about the acceptance. So because of the security and speed benefit, symmetric encryption algorithm like AES have become the gold standard of data encryption. And as a result, they have enjoyed decades of industry adoption and acceptance. And then it requires a low computer resources. So when compared to a public key encryption, single key encryption uses fewer computational resources and then it minimizes the message compromises. So a distinct secret key is utilized for communication with each party preventing a widespread message security breach.
And only the messages sent and received by a specific pair of sender and recipient are affected if a key is compromised. So other people's communications are even still safe. So these are the major advantages of the secret key encryption. And now let's see what are the major disadvantages of the secret. So the disadvantage of secret key encryption is that it assumes two bodies have agreed on a key and initialization vector that is IV and the communication has been established between their values. So the initialization vector that is the IV is not regarded as a secret and can be transmitted with the message as a plain text.
Therefore, the key must be kept secret from an unauthorized users. And because of these disadvantages, the secret key encryption is most often used along with public key encryption to communicate the values of the key and the initialization vector privately. So let's see what are the other kind of disadvantages do we have over this cigarette encryption. So the first point is about the sharing of the key. So the most significant drawback of the symmetric key encryption is that the key must be communicated to the party which you share the data.
And the encryption keys are in just plain text string just like passwords and they are essentially nonsense block. As a result, you will need a secure method of the delivering the key to the other party. And of course, you generally don't need to use an encryption in the first place if you have a secure mechanism to communicate the key. So with this in mind symmetric key encryption is particularly beneficial for encrypting your data rather than distributing the encrypted data. And then the next one is if your security is compromised, you will risk more damage because when someone obtains a symmetric key, they can decode anything that has been encrypted with that particular.
So when two-way communications are encrypted by symmetric key encryption, both sides of the conversation are very much on the wronger hands and it is more vulnerable to. So someone who obtains your private key can decode communication sent to you, but they won't decipher the messages sent to the other person because they are encrypted with a different key. Because both the sender and the recipient have the same key and the messages cannot be validated as coming from a specific user. If there is an disagreement and this might be a very big problem.
So in the symmetric cryptography, the same key is employed for each of the operations in the crypto system. That is an encryption and the decryption and that's the same key has to be shared by the parties performing the various kind of operation. So let's see in this diagram how the symmetric cryptography is being used and how it is being illustrated in the first place. So in this diagram, we could see a plain text is being used and then the image represent about the what kind of message it has exactly.
And then it has been passed to the encryption algorithm. So if you're trying to use this encryption algorithm using a shared key, this key is going to encrypt your message in the first place. And that encrypted message is what we call as a ciphertext. So as you could see in this particular image, this ciphertext is in the non-readable. So even though if any kind of intruder is trying to access this message in the first place, they can't view what kind of message is exactly. Since it has been encrypted with a shared and this message is being sent to the destination user here.
So when the designated user is trying to view this message, so even he is going to use this same shared key where with that key, he is going to open that message where it used to convert the ciphertext to the original plain text. So this is how the symmetric encryption works. So it is just a single key where all kind of encryption and decryption takes place. So one of the basic terminologies that we have been using in this overall slice that we have solved. So the first one we saw about the initialization vector.
So it is just a random number that is used along with the secret key and then the key stream. So the key stream is a continuous sequence of symbols which is used with the plain text to generate a ciphertext. So let's see what are the types of symmetric cryptography. So in symmetric cryptography, there are two types of ciphers. So here we could see there are stream ciphers and blocks. So in the upcoming slides, let's see what are the major things that we are using in both of these cryptographic types.
So let's see about what is the stream cipher. So let's see about what is the stream cipher. And what are the major types it have in it. So a stream cipher is a symmetric key cipher where plain text digits are merged with the pseudo-random cipher digit stream. And each plain text digit is encrypted serially one at a time in a stream cipher with the corresponding digit of the key stream to give a digit of the cipher text string. So a stream cipher is an encryption technique that works byte by byte to transform the plain text into a code that is unreadable to anyone without the proper key.
And stream ciphers are linear. So the same key both encrypts and decrypt messages and while cracking them can be very difficult and hackers have managed to do it also. And for that reason, experts feel stream ciphers aren't safe for widespread use. Even so, plenty of people still lean on this technology to pass information through the internet. So how do the stream ciphers work exactly? So all cryptographic methods aim to scramble the data to hide it from the outsiders. But unlike their counterparts, stream ciphers work on each bit of data in a message rather than chunking the message into groups and that is encrypting them into the blocks.
So the stream ciphers really rely on the plain text. That is, you must have a message that would like to encode. And then the next one is about the key stream. So this is a set of random characters replaces those in the plain text. They could be numbers, letters, symbols. And then the last one is about the cipher text. So this is nothing but an encoded message where your message will be encrypted. So generating a key is a complicated mathematical process. Even so, most computers can push through each step in seconds.
And the bits of plain text enter the stream cipher and the cipher manipulates each bit with the mathematical formula. The resulting text is completely scrambled and the recipient can't read it without the proper key. So with the right key, the recipient can push the cipher text back through the stream cipher and transform the gambled data back towards plain text. So how was stream cipher being used even in these days? So if you have ever watched a movie about the World War II, you could have probably seen a power of stream cipher's fist hand.
So German officials used this technology to send directions to their troops and it took years for English experts to crack the code. So the Germans used a complicated machine that looked a bit like a typewriter. A set of 26 lights above the keys made their transformation plain. On the light represented a converted letter and then they changed the keys regularly and a push of a button updated the enigma to tap out the nodes in the new code. So an online model lets you tinker the enigma and then tapping out the word welcome on the simulation returned a encoded messages for J O T S K I.
So this is how the welcome message sounds about. So the history is fascinating, but make no mistake, steam ciphers didn't go out of style when the war ended and in fact plenty of people use this technology. So steam ciphers come with plenty of benefits and I've just tried to explain that in a few points. So it is about the speed. So this form of encryption is typically faster than others including the block ciphers and then the next point is above the low complexity. It is easy to incorporate steam ciphers into a modern programs and developers don't need a complex hardware to make it happen.
And then the serial nature. So some companies deal with messages written in a trickle with their bit by bit processing steam ciphers allow them to send information when it's ready rather than waiting for everything. to be done and then it is very ease of use steam ciphers are symmetrical encryption tools. So companies aren't forced to bother with public and private and mathematical concepts that underline modern steam ciphers allow computers to determine the proper decryption key teams. And because steam ciphers are easy to implement many people and organization use them.
In fact, most web browsers and websites use this technology and when you connect to protected websites, the site sends you computer and SSL certificate that document is encrypted and most sites use steam ciphers for the communication. So what are the advantages of the steam site? So with the properly designed pseudo random number generator, a stream cipher can be as safe as a block cipher to equal the key strength. And the main advantage of the steam cipher is that steam ciphers that do not use block ciphers as a constructing block are usually faster and use a less code than do block cipher for applications that needed encryption decryption of a stream of data, including over a data communications channel or a browser or web link.
A stream cipher can be the superior alternative and for applications that manage with blocks of information, including a file transfer, email and the database block ciphers can be most suitable. However, this type of cipher can be utilized in essentially on any kind of application. So what are the types of steam ciphers we have? So here we have a synchronous steam cipher and then asynchronous steam cipher. That is a self synchronous. So in synchronous, the key stream is generated independently of the plain text and of the cipher text.
And then in a self synchronous, the key stream depends on the secret key of the scheme, but also a fixed number. Say it is a T of a cipher text digits. So let me give you a quick brief through of what is a synchronous stream cipher as well. So in synchronous stream cipher, a stream of pseudo random digits is generated independently of the plain text and cipher text messages. And then combine them with the plain text that is to encrypt or the cipher text that is to decrypt.
In the most common form, binary digits are used that is bits and the key stream is combined with the plain text using the exclusive or operation that is XOR. So this is termed by a binary additive stream cipher. So in synchronous stream cipher, the sender and the receiver must be exactly in step for decryption to be successful. If digits are added or removed from the message during transmission, synchronization is lost. And to restore the synchronization, various, various offsets can be tried systematically to obtain the correct decryption.
And another approach is to tag the cipher text with markers at regular points in this output. If however, a digit is corrupted in transmission rather than added or lost, only a single digit of the plain text is affected and the error does not propagate to other parts of the message. So this property is useful when the transmission error rate is high. However, it makes it less likely the error would be detected without the further mechanism. Moreover, because of this property, synchronous stream ciphers are very suspectable to active attacks.
So if an attacker change digit in the cipher text, they might be able to make predictable changes to the corresponding plain text bit. For example, flipping a bit in cipher text causes same bit to be flipped in the plain text. So this is all about the synchronous stream cipher. So let's see about a self-synchronous stream cipher. So the another approach uses several of previous n ciphertext digits to compute the key stream. Such schemes are known as self-synchronizing stream ciphers, asynchronous stream ciphers or ciphertext auto key that is C-P-A-K.
The idea of self-synchronization was patented in 1946 and has the advantage that the receiver will automatically synchronize with the key stream generator after receiving the n ciphertext digits making it easier to recover if digits are dropped or added to the message stream. And single digit errors are limited to their effect and it is affecting only up to the n plain digit text. So an example of self-synchronizing stream cipher is a block cipher in cipher feedback. There is CFP mode. So this is about the self-synchronous stream cipher.
So in this we could see what are the types of stream cipher examples that we had in the earlier side. So in the synchronous stream cipher we could see the image mentioning the IV and the key. So it is using the key stream and then in the bottom we could see a plain text which is being encrypted and which is sent to a ciphertext that is for encrypting the data. And on the other hand we could see it is using the key stream and the decryption process to make sure it is converting into the plain text.
So this is about the synchronous stream cipher and in the below image you could see the self-synchronous. So it doesn't use the IV part here. So it is just using the key and the plain text for the encryption because it is automatically trying to capture the inputs of the IV and then now it is being converted into ciphertext. And then when it is coming to the decryption part it uses the IV that is being taken automatically and then the key part is being used and with this the send message has been decrypted as a plain text.
So what are the types of stream cipher example that we have been trying to use on a day today? So you could see there are A5.501, A5.2, EO, Crypto1, RC4. Cha-Cha. So, these are the many types of stream ciphers that we have been using on a daily basis. So, based on this widely used, let's see the reverse cipher on the upcoming slides. That is the RC4. So, it is known as a reverse test cipher 4 or ARC4 or an ARC4. So, how did we be generating the key stream and how does it work? So, this initialize a permutation of 256 possible bytes with two index pointers.
The permutation is initialized with a key between 40 to 2048 bits with the help of a key scheduling algorithm. So, here to run the pseudo-random number generation algorithm on the output form for the KSA to generate the key stream. So, let's get more insight about this RC4. So, in 1987, a man named Ron Rivers developed the RC4 encryption method. He intended to keep the rules of the cipher secret and if his plan had worked, he would have created one of the safest tools anyone could have used to protect the information.
Unfortunately, his plan didn't succeed. 1994, an anonymous person posted an description of the cipher's rules in a public space. So, now that RC4 rules are out in the open, we know how much more about and how it works. Unfortunately, that means the hackers known a lot more about how to break it. So, where this RC4 relies on upon? So, the first point is about the key inputs. So, this tool generates an 8-bit number cipher that is impossible to guess. And the key stream, that is the cipher scrambles the plain text.
And then the product, the XR operation that combines the key stream with the cipher. Developers continue to build on and improve the RC4 encryption. They hope to minimize the hacking risk. Although, experts say hackers can still get through using this RCA. So, the new versions include RC4A, VM, PC and spreads. So, the programmers keep working on tools like this due to ongoing hacking risk. Encryption protects very delicate information including company trade secrets. People must share the data so others can work with it. But without encryption, anyone could see the data as it passes from one person to another.
And poor encryption tool create more vulnerable that hackers can exploit it. The stronger the system, the more completely it can protect you. So, how does this RC4 work? So, the RC4 encryption is in omnipresent. In fact, the Internet Engineering Task Force has explicitly banned RC4's use in some spaces. But knowing how the tool works could help you improve upon it as you look for ways to protect your data. So, to explain things simply, RC4 relies on step-by-step model. So, the first one is about the initial.
You input a secret key and the text you would like to protect. And then encrypt. The cipher scrambles your text via encryption. The work happens byte by byte rather than in chunks. And then the next point is about the send. You scramble text helps to recipient. That person should have a copy of the secret key you use to protect the data. And then the decryption. So, the recipient walks back through these steps to uncover your original text. So, what are the advantages and disadvantages of this RC4?
So, should you use this form of encryption or should you keep digging until you find a tool that's perfect in every way? Understanding the risks and benefits can help you to make your a smart choice for yourself and your business. Speed and use of, I mean the use are among the RC4's major benefits. With just a few lines of code, you can implement protection with RC4 encryption and you won't cause any kind of lag or drag for your user. But RC4 can be hacked especially if you use the same key repeatedly.
If a hacker breaks the code once and you use the same key, you have extended an open invitation to decode everything that you send. So, you must proceed with care. An RC4 along is it ideal if you have tiny bits of data to send across. The tool is meant for use and very large pieces of information and it can break down and apply to something small. In this RC4, we could see there is a part called KSA. So, this initialize an array permutation that is S.
And it defines the key length possibility between 0 to 255. And this initialize a temporary vector and that is initialized to identify the permutation. Then the part S goes through 255 that is iteration with the key length and defined in the previous step. So, the output from KSA is to fed to the PRGA which we will be trying to see on the upcoming. So, the KSA, key scaling algorithm that initialize the process in an array typically refers to RC4 as what I said earlier. So, this is all about the KSA.
So, in this slide, you could see a diagram which we have mentioned. So, on the image, you could see the pointer start with the S and it is showing a bits of start from 0, 1 to 255. So, if I need to have this key to be done, I will be trying to use the I plus J on the key that whatever I am trying to do. So, it is a combination of S of I plus S of J where it will be on overall K value where it is the S of I plus S of J.
So, in this we are going to see about the pseudo random number generation. So, here we need to initialize the I and J to the 0. So, I is known to public and J is the key which is not even revealed. So, in each iteration, increment the I and look up the Ith element of the S so that S of I and then add to the J value. It exchanges the value of S of I and then S of J and use the sum of S of I plus S of J that is the model of 256 as an index to fetch the third element of the S and the key stream of the K value.
That is only below that which you have saw on the previous image. Then bitwise exclusive or with the next byte of the message to get the next byte of either the plain text or the cipher text. So, once you have added the S of I plus S of J, make sure that you are using an XOR condition. That is, we need to make sure that it is converted into the bits value. So, let us say for example, if it is the value of 3, we need to make sure that it is in the 1011 or 110.
So, make sure that whatever the number it is, it must be on the XOR form. So, each element of S is replaced with another element at least once every 256 iterations. So, in this page, we could see how it is being implemented using a simple diagram. So, on an installation vector, you could see it is being implemented with the S array. And then on the other hand, there is the secret key which we are trying to implement with the T array. And this permits with the KSA and then permits again by the PRGA and then the K stream.
And then once the key stream is being implemented, we can use the XOR operations so that I can try to convert into a plain text or a plain text. So, in PRGA, the data is fed into byte by byte and a mathematical model modifies it. So, the model looks up values and then add to 256 and then uses the sum as the byte with the key stream. And then it swaps each element with the another at least one of every 256. So, this is how the pseudo random number generator works.
So, there we can do it with the region, it will be great for the entireités, So, I say Bangladesh. And then we can like northern herkes.