[Little-Brosers] Encryption[#2] and Compression


(context: everyone should be able to verify every message)

We changed our encryption, we decided to use RSA only (with 2048 bit keys).

With the padding scheme (OEAP), we have approximately 190 bytes of plaintext.

The total size of a message is 368 bytes.

The overhead seems huge, we will maybe implement an hybrid encryption with AES, but the overhead would still be big: 16 bytes IV, ~8 bytes padding (mean), 32 bytes MAC, 64 bytes signature)

We hash the encryption key and transmit it to let the receiver know which key was used to encrypt (or we would lose the plaintext non-repudiation property).

Because of the small allowed message size, we can try to compress them.


I tested two compression software: gzip (with default options) and smaz (source). Smaz is optimised for english, and is only 200 lines of c.


(sentences about BLE are from wikipedia BLE articles)

Sentence 1: “Les modes BLE (bande passante plus limitée et très faible consommation) et Bluetooth standard (niveau d’émission plus élevé et portée plus grande) sont donc des technologies complémentaires.”

Smaz: 76 % (output size on input size, smaller is better)

gzip (default options): 91 %


Sentence 2: “Borrowing from the original Bluetooth specification, the Bluetooth SIG defines several profiles — specifications for how a device works in a particular application — for low energy devices.”

Smaz: 65 %

gzip: 84 %


Sentence 3: “eiv9TaecCei3tah9quahJe 7aaCha8AinaewaZ1errait0Koizuo9ahQuikooQu6ahy air3saMeee LiPh8aieWae3HoaiThahb4Eer1dooGwu4Rae2aaichoe5F” (high entropy string)

Smaz: 117 %

gzip: 113 %


Smaz looks pretty good, it is better than gzip even in french. We will try to adapt it for the french language.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>




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