I recommend Blowfish http://en.wikipedia.org/wiki/Blowfish_(cipher)
It has supposedly the same security level as AES. It has even shorter blocks of 8 byte. Moreover it is significantly more efficient for long-term usage and requires very little code.
It has however a significant initialization time (I expect 100 ms.) and quit a large RAM footprint 4k. If the initialization happens only once per boot the initialization time should not be an issue.
You can run any block cipher in two parallel modes - Counter Mode for Encryption and CBC Mode for Message Authentication (Cryptographically Secure CRC). Note, I basically described here the CCM mode. The last block of the CBC output is used as MAC/CRC.
Keep in mind that you should use a different initialization vector (basically a random value) for every new message to prevent static analysis of the data.
The IV may be sent in clear and often precedes the payload of each message.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I recommend Blowfish http://en.wikipedia.org/wiki/Blowfish_(cipher)
It has supposedly the same security level as AES. It has even shorter blocks of 8 byte. Moreover it is significantly more efficient for long-term usage and requires very little code.
It has however a significant initialization time (I expect 100 ms.) and quit a large RAM footprint 4k. If the initialization happens only once per boot the initialization time should not be an issue.
You can run any block cipher in two parallel modes - Counter Mode for Encryption and CBC Mode for Message Authentication (Cryptographically Secure CRC). Note, I basically described here the CCM mode. The last block of the CBC output is used as MAC/CRC.
Keep in mind that you should use a different initialization vector (basically a random value) for every new message to prevent static analysis of the data.
The IV may be sent in clear and often precedes the payload of each message.