embedded-trainings-2020/embedded-workshop-book/src/radio-puzzle.md

26 lines
1.5 KiB
Markdown
Raw Normal View History

2020-07-08 13:06:49 +00:00
# Radio Puzzle
2020-07-15 11:53:22 +00:00
Your task in this section is to decrypt the [substitution cipher] encrypted *ASCII* string stored in the Dongle. The string has been encrypted using *simple substitution*.
[substitution cipher]: https://en.wikipedia.org/wiki/Substitution_cipher
✅ Flash the `puzzle.hex` program on the Dongle. Follow the instructions from the "nRF52840 Dongle" section but flash the `puzzle.hex` program instead of the `loopback.hex` one -- don't forget to put the Dongle in bootloader mode before invoking `dongle-flash`.
2020-07-08 13:06:49 +00:00
> Note: If you experienced USB issues with `loopback.hex` you use the `puzzle-nousb*.hex` variants.
2020-07-08 13:06:49 +00:00
Like in the previous sections the Dongle will listen for radio packets -- this time over *channel 25* -- while also logging messages over a USB/serial interface.
2020-07-15 11:53:22 +00:00
✅ Open the `beginner/apps` folder in VS Code; then open the `src/bin/radio-puzzle.rs` file. Run the program.
2020-07-08 13:06:49 +00:00
2020-07-15 11:53:22 +00:00
## Dongle Responses
2020-07-08 13:06:49 +00:00
The Dongle will respond differently depending on the length of the incoming packet:
- On zero-sized packets it will respond with the encrypted string.
- On one-byte sized packets it will respond with the *direct* mapping from a *plaintext* letter (single `u8` value) -- the letter contained in the packet -- to the *ciphertext* letter (`u8` value).
- On packets of any other length the Dongle will respond with the string `correct` if it received the decrypted string, otherwise it will respond with the `incorrect` string.
The Dongle will always respond with packets that are valid UTF-8 so you can use `str::from_utf8` on the response packets.