Security and Cryptography
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationSecurity and Cryptography

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 13th, 2006, 02:34 PM
rman53 rman53 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 2 rman53 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 m 34 sec
Reputation Power: 0
Can RC4 be used in either CBC or ECB mode?

Hi,

This may be a silly question but can RC4 be used in either CBC or ECB mode?

Thanks!

Reply With Quote
  #2  
Old January 13th, 2006, 07:53 PM
B-Con's Avatar
B-Con B-Con is offline
Crypto-Con
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Apr 2004
Location: UC Davis
Posts: 6,664 B-Con User rank is Lieutenant General (80000 - 90000 Reputation Level)B-Con User rank is Lieutenant General (80000 - 90000 Reputation Level)B-Con User rank is Lieutenant General (80000 - 90000 Reputation Level)B-Con User rank is Lieutenant General (80000 - 90000 Reputation Level)B-Con User rank is Lieutenant General (80000 - 90000 Reputation Level)B-Con User rank is Lieutenant General (80000 - 90000 Reputation Level)B-Con User rank is Lieutenant General (80000 - 90000 Reputation Level)B-Con User rank is Lieutenant General (80000 - 90000 Reputation Level)B-Con User rank is Lieutenant General (80000 - 90000 Reputation Level)B-Con User rank is Lieutenant General (80000 - 90000 Reputation Level)B-Con User rank is Lieutenant General (80000 - 90000 Reputation Level)B-Con User rank is Lieutenant General (80000 - 90000 Reputation Level)B-Con User rank is Lieutenant General (80000 - 90000 Reputation Level)B-Con User rank is Lieutenant General (80000 - 90000 Reputation Level)B-Con User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 5 Days 21 h 53 m 29 sec
Reputation Power: 879
An explanation of what CBC and ECB modes are.

These modes only apply to block ciphers, as they are designed to function using each block output. Block ciphers encrypt plaintext in blocks of a predefined size. RC4 (which, btw, is trademarked, so you should legally implement it under the pseduo-name ARCFOUR ) is a stream cipher, meaning that it encrypts each bit/byte individually "on the fly", if you will. Thus these block cipher modes do not direcly apply to stream cipher modes.

However, let's try a bit of creativity, to see if is possible to stretch these concepts to apply to stream ciphers, such as RC4.

ECB (Eletronic CodeBook) is just a fancy terminology for saying "this input always maps to that output". Meaning that the output ciphertext of certain input plaintext is always the same, regardless of what ciphertext preceeded it. Stream ciphers generate the keysteam used to XOR by the plaintext bit by bit, with each bit's value relient on it's position in the keystream. In a block cipher ECB mode, the same input block maps to the same output block every single time regardless of it's location. In a stream cipher, by definition, the same plaintext in different locations will be encrypted differently, because (by definition) a stream cipher generates keystream values critical to the position of the plaintext. Thus, one could argue that it is impossible to relate ECB to stream ciphers, based on the very principle that stream ciphers rely on.

Now consider CBC (Cipher Block Chaining) mode. In CBC mode, each block of input plaintext is first XOR'd by the previous output block of ciphertext before being encrypted. Thus, the plaintext for block, say, 5 is XOR'd by the output ciphertext of block 4, and the result is then encrypted. This idea works for a stream cipher, consider the following:

A stream cipher generates what is called a "keystream" of values, each of which is used once to encrypt one value of the plaintext, meaning that there are as many keystream values generated as there are plaintext values. As each byte of the keystream is generated, it is XOR'd by the corresponding byte in the plaintext.

So, to apply CBC mode to a stream cipher you first XOR the plaintext byte by the output ciphertext byte that preceeded it, then XOR it by the keystream byte. Or you could do it in blocks, and XOR a block of plaintext by a similarly-sized block of ciphertext from the plaintext block just before it.

Although there is no inherient need to apply CBC mode to RC4, it is possible to do, and you lose nothing by doing it.
Comments on this post
codergeek42 agrees!
__________________
- "Cryptographically secure linear feedback shift register based stream ciphers" -- a phrase that'll get any party started.
- Why know the ordinary when you can understand the extraordinary?


- Sponsor my caffeine addiction! (36.70 USD recieved so far -- Latest donor: Mark Foxvog
)

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationSecurity and Cryptography > Can RC4 be used in either CBC or ECB mode?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT