Is XOR Encryption with the One-Time pad an option for you?
If the key you use is random, this encryption will be uncrack-able.
And the encrypted message isn't longer then the not-encrypted message.
Here's some pseudo-code:
var key = <random data>
var message;
function encryptMessage()
{
message ^= key;
}
function decryptMessage()
{
message ^= key;
}
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.
Is XOR Encryption with the One-Time pad an option for you?
If the key you use is random, this encryption will be uncrack-able.
And the encrypted message isn't longer then the not-encrypted message.
Here's some pseudo-code: