3DES ECB CBC encrypt and decrypt 32 byte

Hi,

I am trying to encrypt and decrypt data from RFID.

As for now, using ArduinoDES library, I've managed to encrypt and decrypt the data, but limited to 8 byte only.

My application require me to decrypt up to 32 byte long data, is this possible to be done using arduino Mega2560?

My data is in hex.

Thank you.

Your best bet is to try modifying the example that encodes and decodes the same data, so that it processes 32 bytes instead of 8.

The example is hard coded to 8 bytes in lots of places.

If you change the example to 32 bytes and it works, then great.

If it doesn't work, your best option is to post an issue on GitHub.

However it may have been specifically designed only to process 8 byte chunks, so you'd also need to modify the library.
I've no idea what the implications on ram requirements would be, if you had to do that

The idea of triple-DES was that it should be well suited for fast throughput in dedicated hardwired chips.
Whilst you might be able to make an emulator, that would not be how that standard was meant to be used.

Thank you.

Here's the library that I'm referring to.

For the above mentioned, I've tried to look at the library, and there are two files.

  1. DES.cpp
  2. DES.h

in DES.cpp, there are sbox, which contents 254 values. And all these are based on 8 bytes.
What are the things that usually I would need to change, in order to suit that the library can process the 32 byte data.

Using the arduino DES library, I've managed to get a working 8 byte encrypt and decrypt value.

But when I'm sending 32 byte data, only the first 8 byte result are correct. The rest is thrash. (but still in hex).

I'm using keying option 2 for the key. Triple DES - Wikipedia (key 1 similar with key 3)

Please advice.
Thank you in advance.

I know its been a long time since this question was asked. But i think its still nice for google to have it awnsered.

Des is a block cypher. It works on blocks of 8 bytes. To encrypt larger data sets you'll have to chop your data into chunks of 8 bytes and encript each of thouse blocks.

Thats where ECB and CDC come in. but there is a very good article that explains this all:
https://www.adayinthelifeof.nl/2010/12/08/encryption-operating-modes-ecb-vs-cbc/

Hope this helps out.