Search

Helping developers and enterprises secure their code is what we do. Got a project, an RFP, or just some questions? Let us know!

info(at)matasano.com
1-888-677-0666 x0

Playbook is our product. It does firewall sync. To learn more about Playbook, check out the site, or get in touch with us via the web, e-mail, or phone.

playbook(at)matasano.com
1-888-677-0666 x7529 (PLAY)

« Introduction and a Brief Glimpse into the Inner Workings of Matasano | Main | Matasano PFI (as seen on TV!) »
Thursday
Aug272009

A Working Theory About RC4

Via News.YC, a deep dive on the TLS handshake that’s more good than bad, and a recommended read if you’re lucky enough not to have to know this stuff. At the end of this article, and in the YC discussion, an interesting issue: why RC4 vs. AES? TLS can do both.

RC4 is an older stream cipher. AES is a newer block cipher. Block ciphers encrypt in multi-byte chunks (AES’s block size is 16 bytes). Stream ciphers encrypt byte by byte. You might therefore assume RC4 was more convenient to use than AES. RC4 is also simpler than AES, and significantly faster on some benchmarks.

But the practical difference between the two is that you shouldn’t be using RC4. RC4 has significant weaknesses, some of which have contributed to serious breaks in 802.11 security.

The industry “knows” this. So why does RC4 keep popping up? Here’s a theory.

developers like stream ciphers

Stream ciphers seem like what you’d want if you were building crypto into a protocol. Most protocols send variable length messages. Block ciphers force you to think about how to fit those messages into fixed-size blocks.

RC4 is the one stream cipher everyone knows

RC4 is a famously simple algorithm. Extremely easy to implement.

There are lots of other stream ciphers. The eSTREAM project has spent the past several years conducting Stream Cipher Thunderdome, in which seven (7) ciphers remain standing despite the best efforts of full-time academic cryptographers. One of them, Trivium, is comparably simple to implement in C.

But nobody knows anything definite about these ciphers. You can still get fired for picking one of them.

people don’t get block cipher modes

It seems simpler to fit RC4 into a protocol than AES. But it’s remarkably easy to make AES act like a stream cipher: run it in Counter mode (CTR).

In CTR, you don’t use AES to encrypt your plaintext. You use it to encrypt a concatenated (say) 96 bit nonce and (say) 48 bit counter to generate a keystream, which you simply XOR into your plaintext. Every time you run out of keystream, you increment the counter and generate more of it. This is secure as long as the counter doesn’t cycle and the nonce is never reused for a new stream.

CTR turns block ciphers into stream ciphers.

CTR actually has practical benefits over RC4; because the keystream is generated by a counter, you can seek to an arbitrary point in the stream and start decrypting.

This is extremely well known to practitioners, and blessed by the 4 cryptographers at NIST. But a friend of mine recently asked a room full of developers how many knew the difference between ECB and CBC (a much more basic question). Almost no hands.

therefore, RC4

You need to encrypt variable length data. No modern stream cipher escapes the “exotic” stigma. Nobody wants to be the developer who picked FROG or MAGENTA instead of Rijndael before AES. Meanwhile, you don’t “get” block cipher modes. What are you left with?

A bad algorithm that still occassionally gets used in real designs.

a moral of this story?

I suppose I’d argue that if you see a bespoke crypto design, and it dates from after 2000, and it uses RC4, that’s an audit flag.

References (4)

References allow you to track sources for this article, as well as articles that were written in response to this article.
  • Response
    With so many different types of wedding dresses to choose from
  • Response
    Response: fhumgcnfa
    mMTTMmNtysSkeMYzrWz
  • Response
    Response: zsaxtmsw
    joZvOWHj
  • Response
    Response: hgQEgCgR
    GRFgjFfc

Reader Comments (43)

Wonderful post... Very informational and educational as usual!

Acai Optimum

March 8, 2010 | Unregistered CommenterAcai Berry

Juicy clothes
Buy full line Juicy couture products from our site at a low price to make yourself a fashionista! Dress juicy couture clothing, holding juicy couture
Shop prom dresses, formal dresses, prom shoes, 2010 designer prom gowns at dres4sale.
for cocktail dresses, dresses for prom, homecoming dresses, and evening dresses. Cheap prom dresses or couture designer evening gowns for your next formal.
evening dresses
Evening Dresses. Women's Formal & Special Occasion Dresses ... Welcome to Cheap Evening Dresses for Sale! ... Buy Cheap Evening Dresses Sales & Accessories
prom dresses

March 20, 2010 | Unregistered Commenterasdasd

RC$ is so good to use. I think this is definitely the future. I think this should be pushed more in the future.
california whistleblower lawyer

April 22, 2010 | Unregistered Commenterjames lee

We glad to suppose you our essay writers

April 23, 2010 | Unregistered CommenterJohn

P90x .It really is not expensive if you factor in the cost

of a gym membership,P90x workout . The cost for P90X is

about three months of a paid gym membership but you get to

keep the program foreverP90x . You can try many of the

online sites, but it will be the same as buying from the

company or a Beachbody Coach. Make sure you are getting

original DVD's. People are selling copies all over. The

problem is how long will they last, P90x workout ,and you

truly need the exercise and nutrition guide to even follow

the program. You can go to any site

http://www.p90xmall.com/ or you can go to and click on

products. P90x dvd You can order directly from the

site,P90x dvd.

May 8, 2010 | Unregistered Commenterp90x

Provide high quality silver Tiffany jewellery including necklaces,rings and other style jewelry at wholesale prices.Pick your dreaming
Tiffany jewellery
Tiffany co
Tiffany
Tiffany Stores is the best online United Kingdom jewelry stores where you can buy the cheapest Tiffany & Co silver jewelry.
Our huge selection of Tiffany
Tiffany & Co Rings
Tiffany & Co Earrings
Tiffany & Co Bracelets
Buy cartier ring, cartier love on abcartier.com. We also provide cartier bracelet, cartier jewelry and so on. Now come on and get what you want.
Cartier Jewelry
Cartier jewellery

May 31, 2010 | Unregistered Commenterharry123

The article written by your very good, I like it very much. I will keep your new article.
rosetta stone spanish,
rosetta stone,
rosetta stone language.

June 6, 2010 | Unregistered Commenterrosetta

Hi,
Very informative post and educational post, I personally like it. According to me AES is much useful than RC4, as using RC4 requires enough proficiency, while AES is easy to use and also a new developer can use it easily.

Business Plan Writer

June 7, 2010 | Unregistered CommenterBusiness Plan Writer

I must say that your article was surprisingly helpful!
msd250

June 16, 2010 | Unregistered CommenterAnna

People usually say :"Seeing is believing." GHD Each attempt has a corresponding gain, in part or obvious, or vague. At least we have the kind of satisfaction After I bought this watch ,in a sense,it means a great deal to me. net a porter thank you!it is very useful tools to protect our time.If you never pay attention to yourself ,please grasp this chance.a few days ago,I bought a Rolex watches.IT's very good to use.So i want to write an article about watches to share with everyone on So as to more and more people to konw it. UGG brand is relatively common, in addition to the Rolex ping g15even see watch on the movement and you don't know.
Rolex watches

June 25, 2010 | Unregistered Commenterrolex watches

The post is very nicely written and it contains many useful facts. I am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement. Thanks for sharing with us
lace wigs
lace front wigs
full lace wigs
lace wigs
lace front wigs
lace front wig

June 25, 2010 | Unregistered CommenterMonica
June 26, 2010 | Unregistered Commentertyu

We can pass all your MCSE exams and get you MCSE certified within 7 days. Exams will be taken in the authorized testing center. Your certification status can be verified on the Microsoft official website and the certificates will arrive from Microsoft at your owned address. You get MCSE certified without ever having to set foot into a testing center. Just sit back and relax after placing an order. 70-620

July 8, 2010 | Unregistered Commenterliuhan

Professional wow gold buy store

July 12, 2010 | Unregistered Commenterabvcd

I agree with articles point it really very good. 4 week cna classes

July 12, 2010 | Unregistered Commenter4 week cna classes

This Post gives me lot of information Great to read
casino en ligne
casino en ligne francais

July 19, 2010 | Unregistered Commenterstewbiff

We<font color="#FF0000" size="3">thomas wylde</font> said this is a great<font color="#FF0000" size="3">gianni versace handbags</font> manufacturers, <font color="#FF0000" size="3">replica handbags</font>is an important factor of human<font color="#FF0000" size="3">fendi handbags</font> society, the national <font color="#FF0000" size="3">cheap chanel handbags</font>security forces <font color="#FF0000" size="3">Patek Philippe for sale</font>and have significant <font color="#FF0000" size="3">Piaget for sale</font>contribution to a general<font color="#FF0000" size="3">Rado for sale</font> far beyond <font color="#FF0000" size="3">Rolex for sale</font>the business scope <font color="#FF0000" size="3">prada handbags</font>of the table. <font color="#FF0000" size="3">thomas wylde handbags</font>In the 20th century, <font color="#FF0000" size="3">chloe replica handbags</font>, is the world's most<font color="#FF0000" size="3">replica Audemars Piguet</font> important strength,<font color="#FF0000" size="3">replica Baume & Mercier</font> is one of the <font color="#FF0000" size="3">replica watches</font>brand. First will<font color="#FF0000" size="3">replica watches</font> be far more than <font color="#FF0000" size="3">Maurice Lacroix replica</font>40 years of EI<font color="#FF0000" size="3">Montblanc replica</font> legendary hero.<font color="#FF0000" size="3">movado replica</font>As a contemporary <font color="#FF0000" size="3">Tag Heuer for sale</font>horological production history of legend

July 22, 2010 | Unregistered Commenterreplica watches

Juicy Couture womens fashions at Juicy Couture. Shop popular stores to find Juicy Couture womens fashions on sale - all in one place.
juicy couture
juicy couture handbags
Juicy Couture was founded in 1997, by Gela Nash-Taylor and Pamela Skaist-Levy, as premium designer, marketer
Juicy Couture is a contemporary line of both casual and dressy apparel based in Arleta
juicy couture jewelry
Find a great range of Ed Hardy products. Ed Hardy Women's Ellerise Lowrise Sneaker · Ed Hardy Women's
thanks for your post.perhaps you will like
Ed hardy bags
Ed hardy T Shirts
ed hardy belts and Accessories On Sale,Official Ed Hardy Store for all Clothing and Gear,Ed hardy bags.,Mendelly beddings,crystal jewelry

July 27, 2010 | Unregistered Commenterjuicy couture
Editor Permission Required
You must have editing permission for this entry in order to post comments.