After a week of struggling RC4 seems to be ready and operating, here are some results:

The key sent by a master (here it’s simply “Key” wrapped many times, creative isn’t it?)
ciph1

Then the message that needs to be encrypted (here “Plaintext”, yet again cunning)
ciph2j

And finally the result !
ciph3

Of course it’s hard to tell whether it’s true by simply looking at the cyphertext so here is the proof. It does match!

Now, a few technical details:

Generation of the keystream is very fast – 2 clock cycles per byte, however average speed is lower (but tends to 2cyc/byte for long files). It is because whenever a new key is obtained algorithm needs to perform initialization which takes 256 + 512 clock cycles (the so called KSA part).

Module uses 512B of memory: 256B for the S array and 256B for the key, which is later reused to store the encrypted data (since our master and slave communicate through 32bit wishbone interface, master is able to read 4 times faster than the cyphertext is generated, thus instead of reading 2cyc, waiting 6cyc, reading 2cyc and so on, reading is performed in a block of 256B when it’s ready, followed immediately by sending next piece of data or a new key if needed)

Starting from this week I will be working on one of the digital signature algorithms, called ECDSA (Elliptic Curve DSA). This will be the biggest challenge as it is far more complicated than the algorithms I was previously dealing with, but I’m quite excited about it.

Categories: Experiential

0 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.