I'm developing a medical device that operates under extreme low-power constraints and transmits data with BLE, where every unnecessary millisecond of air time matters. I am developing a Beacon advertising protocol where sensor data is encoded directly into the advertising packet. The data I need to transmit is very simple and small, occupying only two to four total bytes. I would like to encrypt these 2-4 bytes before adding them to the advertising packet, to be decrypted by the receiving smartphone after being pulled out of the advertising packet. I'd like to keep the encrypted data as small as possible, whereas I know many algorithms create set length strings (20+ bytes).

I am currently transmitting these 2-4 bytes as hexadecimal values, to be interpreted as integer values by the receiving smartphone application. I am not overly experienced with cryptography or encryption methods, but do know that most algorithms operate on larger pieces of data. Are there any algorithms or protocols that would be appropriate for such small pieces of data?

The data is very primitive, just two - four unsigned 8 bit integers. The main objective is to ensure an unintended observer cannot deduce the integers which are encoded within the advertising packet.

An example of the advertising packet would be:


where "00-01-02-03" are the 4 hexadecimal values I wish to encrypt. No more information can be shared with the smartphone, so the protocol needs to be mutually understood before advertising packets are transmitted. The device will ship with a unique identifier, entered into the phone during phone <--> device setup, so there I believe this can be accomplished.

I have thought that some kind of simple lookup table might suffice, where the phone and device both know how to encode/decode using the table? The values can of course be encrypted before placement into the advertising string.

  • $\begingroup$ Read about stream ciphers for byte wise encryption. But encryption usually needs a key that's common between sender and receiver. How can you arrange that - hard coded key in all transmitters/receivers? $\endgroup$ – Paul Uszak Nov 6 at 12:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.