You are here

Matlab

More Matlab and RC4

A reader asked for more details on the RC4 and block cipher mode functions I wrote in Matlab.

To recap, I needed a 'block cipher' to produce a complete example of how a straight block cipher fails to hide large patterns in the output, and how an appropriate block cipher mode yields something akin to white noise.

Wikipedia has a "penguin" example with a block encrypted version (penguin still visible) and a block of white noise. The white noise represents what the block mode output is supposed to look like as opposed to being the genuine output of a block cipher mode. So I built this 'real' example, more or less.

I didn't have a block cipher that worked with small blocks. But I knew it wasn't hard to implement RC4. So I created a function to map 8 bytes of data into 8 bytes of 'ciphertext' to simulate the block cipher.

Post category: 

Matlab, RC4, and Crypto-Graphics

A while back I used graphical images to illustrate why you never, ever want to reuse the keystream of a stream cipher. Recently I've constructed similar examples to show the role of modes in using block ciphers. There's a nice set of block mode examples in Wikipedia, but I wanted to include the real result of applying the mode.

 

smileycolorsmileyecbsmileycbc

 

While cryptographic neophytes may want to know why the second encryption clearly failed (if you can read the message, the encryption failed), cryptographic experts may find it interesting to see other examples of cryptographic failures appearing graphically.

 

[There is a later post with more info on RC4 in Matlab

]

 

A while back I used graphical images to illustrate why you never, ever want to reuse the keystream of a stream cipher. Recently I've constructed similar examples to show the role of modes in using block ciphers. There's a nice set of block mode examples in Wikipedia, but I wanted to include the real result of applying the mode.

 

smileycolorsmileyecbsmileycbc

 

While cryptographic neophytes may want to know why the second encryption clearly failed (if you can read the message, the encryption failed), cryptographic experts may find it interesting to see other examples of cryptographic failures appearing graphically.

 

[There is a later post with more info on RC4 in Matlab]

 

Post category: 

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer