04.06.2020»»четверг

Key Generation In Stream Cipher

04.06.2020

In cryptography, a keystream is a stream of random or pseudorandom characters that are combined with a plaintext message to produce an encrypted message (the ciphertext).

The 'characters' in the keystream can be bits, bytes, numbers or actual characters like A-Z depending on the usage case.

Usually each character in the keystream is either added, subtracted or XORed with a character in the plaintext to produce the ciphertext, using modular arithmetic.

Keystreams are used in the one-time pad cipher and in most stream ciphers. Block ciphers can also be used to produce keystreams. For instance, CTR mode is a block mode that makes a block cipher produce a keystream and thus turns the block cipher into a stream cipher.

Example[edit]

  • We encrypted the encoded key stream as well as the encoded plain text in order to generate the cipher text. We then decrypted the cipher text using the encoded key stream and the decoded the deciphered text using the code tables. The highest entropy value yielded by the NSGA-II-KGA, which in turn indicates the strength of the key generated.
  • Key Generation. The round-key generator creates sixteen 48-bit keys out of a 56-bit cipher key. The process of key generation is depicted in the following illustration − The logic for Parity drop, shifting, and Compression P-box is given in the DES description. DES Analysis. The DES satisfies both the desired properties of block cipher.
  • As well as encryption / decryption algorithm, randomness characteristics of key sequences prove the strength of the stream cipher. In this work the Linear Feedback Shift Register (LFSR) is.
  • This module is about modern ciphers based on product ciphers. We will first define block cipher and contrast it with stream cipher. We will then describe the ideal block cipher, which maximizes the number of transformations, and Feistel Cipher, which is a practical structure framework approximating the ideal block cipher.
  • The state table is used for subsequent generation of pseudo-random bytes and then to generate a pseudo-random stream which is XORed with the plaintext to give the ciphertext. Each element in the state table is swapped at least once. The key is often limited to 40 bits, because of export restrictions but it is sometimes used as a 128 bit key. It has the capability of using keys.

In this simple example we use the English alphabet of 26 characters from a-z. Thus we can not encrypt numbers, commas, spaces and other symbols. The random numbers in the keystream then have to be at least between 0 and 25.

Block Cipher and DES. This module is about modern ciphers based on product ciphers. We will first define block cipher and contrast it with stream cipher. We will then describe the ideal block cipher, which maximizes the number of transformations, and Feistel Cipher, which is a practical structure framework approximating the ideal block cipher.

To encrypt we add the keystream numbers to the plaintext. And to decrypt we subtract the same keystream numbers from the ciphertext to get the plaintext.

If a ciphertext number becomes larger than 25 we wrap it to a value between 0-25. Thus 26 becomes 0 and 27 becomes 1 and so on. (Such wrapping is called modular arithmetic.)

Here the plaintext message 'attack at dawn' is combined by addition with the keystream 'kjcngmlhylyu' and produces the ciphertext 'kcvniwlabluh'.

Plaintextattackatdawn
Plaintext as numbers019190210019302213
Keystreamkjcngmlhylyu
Keystream as numbers10921361211724112420
Ciphertext as numbers10282113822112627114633
Ciphertext as numbers
wrapped to 0-25
1022113822110111207
Ciphertext as textkcvniwlabluh

References[edit]

  • Handbook of Applied Cryptography by Menezes, van Oorschot and Vanstone (2001), chapter 1, 6 and 7.


Retrieved from 'https://en.wikipedia.org/w/index.php?title=Keystream&oldid=848603541'
  • Cryptography Tutorial
  • Cryptography Useful Resources
  • Selected Reading

The Data Encryption Standard (DES) is a symmetric-key block cipher published by the National Institute of Standards and Technology (NIST).

DES is an implementation of a Feistel Cipher. It uses 16 round Feistel structure. The block size is 64-bit. Though, key length is 64-bit, DES has an effective key length of 56 bits, since 8 of the 64 bits of the key are not used by the encryption algorithm (function as check bits only). General Structure of DES is depicted in the following illustration −

Since DES is based on the Feistel Cipher, all that is required to specify DES is −

Android java generate aes key 256. And we want to be able to generate the same key and IV for the same passphrase in.NET and Java - maybe we have Android app written in Java that needs to decrypt message from ASP.NET web app.In.NET, class is often used to derive keys of specified length according to given passphrase, salt, and iteration count.

  • Round function
  • Key schedule
  • Any additional processing − Initial and final permutation

Initial and Final Permutation

The initial and final permutations are straight Permutation boxes (P-boxes) that are inverses of each other. They have no cryptography significance in DES. The initial and final permutations are shown as follows −

Round Function

The heart of this cipher is the DES function, f. The DES function applies a 48-bit key to the rightmost 32 bits to produce a 32-bit output.

  • Expansion Permutation Box − Since right input is 32-bit and round key is a 48-bit, we first need to expand right input to 48 bits. Permutation logic is graphically depicted in the following illustration −

  • The graphically depicted permutation logic is generally described as table in DES specification illustrated as shown −

  • XOR (Whitener). − After the expansion permutation, DES does XOR operation on the expanded right section and the round key. The round key is used only in this operation.

  • Substitution Boxes. − The S-boxes carry out the real mixing (confusion). DES uses 8 S-boxes, each with a 6-bit input and a 4-bit output. Refer the following illustration −

  • The S-box rule is illustrated below −

  • There are a total of eight S-box tables. The output of all eight s-boxes is then combined in to 32 bit section.

  • Straight Permutation − The 32 bit output of S-boxes is then subjected to the straight permutation with rule shown in the following illustration:

Key Generation

The round-key generator creates sixteen 48-bit keys out of a 56-bit cipher key. The process of key generation is depicted in the following illustration −

The logic for Parity drop, shifting, and Compression P-box is given in the DES description.

DES Analysis

The DES satisfies both the desired properties of block cipher. These two properties make cipher very strong.

  • Avalanche effect − A small change in plaintext results in the very great change in the ciphertext.

  • Completeness − Each bit of ciphertext depends on many bits of plaintext.

Stream Cipher Examples

During the last few years, cryptanalysis have found some weaknesses in DES when key selected are weak keys. These keys shall be avoided.

Key Generation In Stream Cipher Download

DES has proved to be a very well designed block cipher. There have been no significant cryptanalytic attacks on DES other than exhaustive key search.