Midbar (Raspberry Pi Pico Version)

by Northstrix in Circuits > Raspberry Pi

1937 Views, 4 Favorites, 0 Comments

Midbar (Raspberry Pi Pico Version)

IMG_20230111_112857_hdr.jpg

Less than two weeks ago, I released the Midbar V2.5. That version of Midbar was protected from the chosen-plaintext attack, block-swapping attack, and brute force attack. It could discern legitimate ciphertexts from forged ones. It was the second version of Midbar that could verify the integrity of the whole records and the first version of Midbar that utilized the 3DES + AES + Blowfish + Serpent encryption algorithm In CBC Mode.

Perhaps, it was (in my opinion) so good that I've decided to port it to the Raspberry Pi Pico. I didn't call it "Midbar (Raspberry Pi Pico Version) V2.5" because it's missing the SQLite3 RDBMS and doesn't have a secure communication channel. But I wouldn't call it a "watered down" version of the Midbar V2.5 either because, at the very least, it has the vault capability of the Midbar V2.5 intact, handles the PS/2 keyboard much better than the Midbar V2.5 and can easily encrypt and then decrypt a 10000-characters long string using the 3DES + AES + Blowfish + Serpent encryption algorithm In CBC Mode. Anyway, after a long consideration, I've decided to call it the "Midbar (Raspberry Pi Pico Version)."


In case you want to know why I called this project Midbar - Midbar (מדבר) is a Hebrew word that means "pasture," "uninhabited land," "wilderness," "large tracts of wilderness (around cities)," "desert." I had two reasons for choosing the word Midbar as the name of this project. First - while working on my previous projects, I noticed that the so-called "device that keeps your personal data secure in an encrypted form" market is pretty much a "desert around the oasis of the password manager market." Second - I couldn't find a better word to describe that project. At first, I wanted to call it a "Password Vault," but then I realized that it's more than just a password vault. So, I just called it Midbar!


*Edited: After writing this tutorial and publishing the original firmware, I made a version of the firmware that's more stable than the original one. You can find it in the "V1.0s" folder.

You can also read this tutorial on Medium and Hackster.

Supplies

IMG_20230112_153420.jpg
  • Raspberry Pi Pico x1
  • 2.4 Inch TFT LCD with ILI9341 x1
  • EC11 Rotary Encoder x1
  • PS/2 Keyboard x1
  • PS/2 Port x1
  • 4.7k resistors x7
  • 100nf capacitors x2
  • Buttons x2

3DES + AES + Blowfish + Serpent in CBC Mode

3des+aes+blowfish+serpent_in_cbc.png

Don't get me wrong - the "3DES + AES + Blowfish + Serpent" encryption algorithm ain't exactly what I would call "cryptographically weak," but operating it in a weird derivation of the ECB mode wasn't the best idea that I had. Although that wouldn't've allowed the attacker to produce the legitimate ciphertext by swapping the blocks within the ciphertext, an attacker could still make a legitimate ciphertext by replacing the nth block of the ciphertext N1 with the nth block of the ciphertext N2. To fix that vulnerability (instead of just notifying the user that the decrypted ciphertext might've been forged), I made the "3DES + AES + Blowfish + Serpent" encryption algorithm work in CBC mode. So, if an attacker replaces a block of ciphertext, it spoils not just that block but also the subsequent one.

I'll be honest with you, the bit-flipping attack "kinda works," but I doubt that it would ever go unnoticed because of the "HMAC-SHA256"-based integrity verification feature.

And by the way, out of all encryption algorithms utilized by this version of Midbar, the "3DES + AES + Blowfish + Serpent" is the only algorithm that works in CBC mode. Beware of it!

Integrity Verification

Integrity verification.png
IMG_20230111_13005.jpg

The Midbar (Raspberry Pi Pico Version) is the third version of Midbar that verifies the integrity of the whole record. So, the legitimate ciphertexts moved between the cells aren't much of a threat to it.

The "HMAC-SHA256"-based integrity verification feature works as follows:

When you add a record to Midbar, it concatenates all the data you've entered into a single string, computes a tag for it, and then stores that tag in the encrypted form.

When Midbar decrypts your data, it also decrypts the previously calculated tag and computes a new tag for the decrypted data. It then compares both tags, and if they don't match - Midbar notifies you that the integrity verification failed.


*All credentials demonstrated here are entirely fictitious. Any similarity to actual credentials is purely coincidental.

Configure Arduino IDE *Optional

If you've never flashed the Raspberry Pi Pico before you need to configure the Arduino IDE first.

Configuring IDE isn't a part of this tutorial. You can read about it here https://www.tomshardware.com/how-to/program-raspberry-pi-pico-with-arduino-ide

Download Firmware

df.png

You can download the firmware for Midbar from one of these sources.

SourceForge: https://sourceforge.net/projects/midbar/

OSDN: https://osdn.net/projects/midbar/

GitHub: https://github.com/Northstrix/Midbar

If you just need the firmware for the device alongside the RNG, then I would advise you to download a 0.6 MB archive either from SourceForge or OSDN.

But if you need the firmware for all versions of Midbar alongside the extra code, photos, and diagrams, in that case, I would advise you to download the 84.2 MB archive from GitHub.

Download and Install the Libraries

Arduino_GFX: https://github.com/moononournation/Arduino_GFX

PS2KeyAdvanced: https://github.com/techpaul/PS2KeyAdvanced

EncButton: https://github.com/GyverLibs/EncButton

*Libraries for the "V1.0s:"

Adafruit_ILI9341: https://github.com/adafruit/Adafruit_ILI9341

Adafruit_BusIO: https://github.com/adafruit/Adafruit_BusIO

The process of unpacking libraries is typical. You can unpack the content of the archive into the folder: ...\Arduino\libraries. Or open the Arduino IDE, click to the Sketch -> Include Library -> Add .ZIP Library... and select every archive with libraries.

Other required libraries are already present in one way or another.

Install Arduino-pico-littlefs-plugin

upl.png

The primary purpose of the arduino-pico-littlefs-plugin is to let you upload the files into the RPI's flash memory. In this tutorial, the purpose of this tool is to format the RPI's flash.

Download the file called PicoLittleFS-0.2.0.zip from https://github.com/earlephilhower/arduino-pico-littlefs-plugin/releases/tag/0.2.0

And then extract the content of the archive into the "...\Arduino\Tools\" folder.

After that, restart the Arduino IDE.

Change the "Flash Size" to the "2MB (Sketch: 1MB, FS: 1MB)"

fs.png

Midbar needs memory allocated for the file system to function.

To allocate the memory for the file system, click "Tools" -> "Flash Size" -> "2MB (Sketch: 1MB, FS: 1MB)"

Format Raspberry Pi Pico's Built-In Flash Memory

lf.png

Click "Tools" -> "Pico LittleFS Data Upload." Then click "Yes" in the pop-up window. The program is going to format the RPI's flash memory.

Generate Keys

keys.png

To make the unauthorized deciphering of your data computationally infeasible - It is crucial to generate your own keys and never reuse them

It's entirely up to you how to generate the keys. I can only offer you an option to do so.

I've modified one of my previous projects to work as a random number generator, the generated output seems "random enough" for me, but I haven't run any tests. So, I can't guarantee that it's random.

Use it at your own risk!

To generate the keys - launch gen.exe from the "Raspberry_Pi_Pico_Version\V1.0\Untested RNG" folder and click the "Generate keys for Midbar" button. The background turns from dark gray to light gray when you press that button.

Modify the Firmware

mk.png

Open the "Firmware.ino" file from the "Raspberry_Pi_Pico_Version\V1.0\Firmware" folder, and then replace my keys with those you've generated.

Flash Raspberry Pi Pico

uf.png

Upload the firmware from the "Raspberry_Pi_Pico_Version\V1.0\Firmware" folder into the Raspberry Pi Pico.

Assemble the Midbar

Midbar Circuit Diagram.png

Assembling the Midbar shouldn't be hard. In my opinion, the most tangled part of the process is to connect the encoder with its periphery the right way.


As for the possible component replacements:

  • You can replace 4.7k resistors with 4.7k - 10k resistors;
  • And you can replace the capacitors with 22nf - 100nf capacitors.

Power the Midbar Up

IMG_20230111_115905.jpg
IMG_20230111_115937.jpg
IMG_20230111_120244.jpg
IMG_20230111_121553.jpg

Unlike the previous version of Midbar, which only had one lock screen, that one has four. The lock screen is randomly chosen at startup.

After the Midbar has chosen the lock screen, it displays the word "מדבר" with the shifting background and the "Press Any Key" inscription.

At that point, press any key to get to the next tab.


*Credit for photos:

Dallas:

Photo by R K on Unsplash

Tel Aviv:

Image by ran from Pixabay

Montreal:

Image by Beenerm from Pixabay

Salt Lake City:

Image by RobinSaville from Pixabay

Set the Master Password

IMG_20230111_123453.jpg
IMG_20230111_123512.jpg
IMG_20230111_123540.jpg

To use the Midbar, you first need to set the master password.

You can only enter the master password using the encoder and PS/2 keyboard.

And remember that you can't change your master password without performing the factory reset first!

Midbar won't be able to decrypt your data without your master password because the keys for the encryption algorithms are partially derived from it. Perhaps, it won't even unlock without the correct master password.

When you're done entering your master password, either quad-click the encoder button or press the "Enter" on the PS/2 keyboard.


After you've unlocked the vault and got to the main menu:

  • Either turn the rotary encoder to the right or press the "" (DOWNWARDS ARROW) key on the PS/2 keyboard to go down the menu.
  • Either turn the rotary encoder to the left or press the "" (UPWARDS ARROW) key on the PS/2 keyboard to go up the menu.
  • Press either the "A" button or the "Enter" key on the PS/2 keyboard to open the selected menu.
  • While in the submenu, press either the "B" button or the "Esc" key on the PS/2 keyboard to return to the main menu.


While entering a text in a tab:

  • Either quad-click the encoder button four or press "Enter" on the PS/2 keyboard to continue;
  • Either quintuple-click the encoder button (click it five times in quick succession) or press the "Esc" button on the PS/2 keyboard to cancel the current operation.


*If the hex value decreases when you rotate the encoder to the right, I would advise you to swap the wires connected to the GP12 and GP13 pins.

And by the way, pressing the "Caps Lock," "Num Lock," or "Scroll Lock" buttons makes the keyboard unresponsive until you either reconnect it or disconnect the RPI from the power source.

Add Login

IMG_20230111_123552.jpg
IMG_20230111_123728.jpg
IMG_20230111_123753.jpg
IMG_20230111_123805.jpg
IMG_20230111_123920.jpg
IMG_20230111_123946.jpg
IMG_20230111_124044.jpg
IMG_20230111_124202.jpg

As I've mentioned in the introduction, the vault capability from the Midbar V2.5 is intact. The Raspberry Pi Pico version of Midbar utilizes the 3DES + AES + Blowfish + Serpent encryption algorithm with an integrity verification feature alongside the LittleFS to keep your data safe and organized.

To add a login from the encoder and PS/2 keyboard:

  1. Select the "Logins" line in the main menu;
  2. Press either the "A" button or the "Enter" key on the PS/2 keyboard;
  3. Select the "Add" line;
  4. Press either the "A" button or the "Enter" key on the PS/2 keyboard;
  5. Choose the slot you want to put the login to either by rotating the encoder or by pressing the "←" (Leftwards Arrow) and "→" (Rightwards Arrow) keys on the PS/2 keyboard;
  6. Press either the "A" button or the "Enter" key on the PS/2 keyboard;
  7. Select the "Encoder + Keyboard" line;
  8. Press either the "A" button or the "Enter" key on the PS/2 keyboard;
  9. Enter the title;
  10. Either quad-click the encoder button or press "Enter" on the PS/2 keyboard;
  11. Enter the username;
  12. Either quad-click the encoder button or press "Enter" on the PS/2 keyboard;
  13. Enter the password;
  14. Either quad-click the encoder button or press "Enter" on the PS/2 keyboard;
  15. Enter the website;
  16. Either quad-click the encoder button or press "Enter" on the PS/2 keyboard.


According to the tests I've conducted - Raspberry Pi Pico can encrypt and decrypt a 10000-character long string without any problems using the 3DES + AES + Blowfish + Serpent encryption algorithm. So, technically, you can put 10 000 characters into a field of a record.


*All credentials demonstrated here are entirely fictitious. Any similarity to actual credentials is purely coincidental.

View Login

IMG_20230111_123552.jpg
IMG_20230111_124356.jpg
IMG_20230111_124404.jpg
IMG_20230111_124414.jpg
IMG_20230111_124419.jpg
IMG_20230111_124425.jpg
IMG_20230111_124431.jpg

To view a login:

  1. Select the "Logins" line in the main menu;
  2. Press either the "A" button or the "Enter" key on the PS/2 keyboard;
  3. Select the "View" line;
  4. Press either the "A" button or the "Enter" key on the PS/2 keyboard;
  5. Choose the slot you want to view login from either by rotating the encoder or by pressing the "←" (Leftwards Arrow) and "→" (Rightwards Arrow) keys on the PS/2 keyboard;
  6. Press either the "A" button or the "Enter" key on the PS/2 keyboard;
  7. Press any key to view the content of the next field.


*All credentials demonstrated here are entirely fictitious. Any similarity to actual credentials is purely coincidental.

Edit Login

IMG_20230111_123552.jpg
IMG_20230111_124517.jpg
IMG_20230111_124523.jpg
IMG_20230111_124536.jpg
IMG_20230111_124544.jpg
IMG_20230111_124656.jpg
IMG_20230111_124404.jpg
IMG_20230111_125313.jpg

To edit a login:

  1. Select the "Logins" line in the main menu;
  2. Press either the "A" button or the "Enter" key on the PS/2 keyboard;
  3. Select the "Edit" line;
  4. Press either the "A" button or the "Enter" key on the PS/2 keyboard;
  5. Select the login you would like to edit either by rotating the encoder or by pressing the "←" (Leftwards Arrow) and "→" (Rightwards Arrow) keys on the PS/2 keyboard;
  6. Press either the "A" button or the "Enter" key on the PS/2 keyboard;
  7. Select the input source;
  8. Press either the "A" button or the "Enter" key on the PS/2 keyboard;
  9. Depending on the chosen input source, either enter the new password you'd like to set on the encoder and PS/2 keyboard or paste it to the Serial Terminal;
  10. Depending on the chosen input source, either quad-click the encoder button (or press "Enter") or press the "Send" button in the Serial Terminal.


*All credentials demonstrated here are entirely fictitious. Any similarity to actual credentials is purely coincidental.

Delete Login

IMG_20230111_123552.jpg
IMG_20230111_124737.jpg
IMG_20230111_124748.jpg
IMG_20230111_124800.jpg

To delete a login:

  1. Select the "Logins" line;
  2. Press either the "A" button or the "Enter" key on the PS/2 keyboard;
  3. Select the "Delete" line;
  4. Press either the "A" button or the "Enter" key on the PS/2 keyboard;
  5. Select the login you would like to delete either by rotating the encoder or by pressing the "←" (Leftwards Arrow) and "→" (Rightwards Arrow) keys on the PS/2 keyboard;
  6. Press either the "A" button or the "Enter" key on the PS/2 keyboard.


The process of working with records of other types is very similar to the process of working with logins.

Encrypt String

IMG_20230111_131431.jpg
IMG_20230111_131437.jpg
IMG_20230111_130730.jpg
IMG_20230111_131327.jpg
IMG_20230111_131347.jpg

As I've mentioned before, Midbar utilizes seven encryption algorithms. You can use any of them to encrypt your data.

To encrypt text:

  1. Open the Serial Terminal because the ciphertext will be printed to it;
  2. Select the "Encryption Algorithms" line in the main menu;
  3. Press either the "A" button or the "Enter" key on the PS/2 keyboard;
  4. Select the line with the name of the encryption algorithm you would like to use;
  5. Press either the "A" button or the "Enter" key on the PS/2 keyboard;
  6. Select the "Encrypt String" line;
  7. Choose the input source;
  8. Press either the "A" button or the "Enter" key on the PS/2 keyboard;
  9. Depending on the chosen input source, either enter the text you'd like to encrypt on the encoder and PS/2 keyboard or paste it to the Serial Terminal;
  10. Depending on the chosen input source, either quad-click the encoder button (or press "Enter") or press the "Send" button in the Serial Terminal.


Plaintext:

In case you want to know why I called this project Midbar - Midbar is a Hebrew word that means "pasture," "uninhabited land," "wilderness," "large tracts of wilderness (around cities)," "desert." I had two reasons for choosing the word Midbar as the name of this project. First - while working on my previous projects, I noticed that the so called "device that keeps your personal data secure in an encrypted form" market is pretty much a "desert around the oasis of the password manager market." Second - I couldn't find a better word to describe that project. At first, I wanted to call it a "Password Vault," but then I realized that it's more than just a password vault. So, I just called it Midbar!

Ciphertext:

d4c57216bdf65992892e91e2651db53d51509c07c7ce90334aa79faa0aa8dc3867ca84498332913f391546c2162fccff7664e29db8a23a49e22dc8b4fe79023bc755f3dc271f532be781b97951ac01539127bbfac028c364426e8500d683f1e4dc05da52f31fc5698016ebdb2d54feb51fc65b2692bb271a79e5714e03715b03950e1b87088d5de280f937ed1c7bbec77dea4e0de869e51a4bc20a2ba114b751614a33c061d4d9d4e46b251caa88a872c8d1a1ab61f432b4f813276d1e31e027e60c90a3abd79cd9266689f24956f822a197948491da7ee5da13c0976bf89b5bd433250679c2e91f4d56c6d11c6f8cd70d878bc6af6cf12fb2a191b3c2f5037e233f3648da89570b76418b9fb6afbc6053bd62c0d741fdb946a279c0cd271cd291ca753343646e610bfbdc8860974b52bb00128e852dc153ea67b50aace4261eef54f9a98eb4c091d725c7d4aed8f136e426723a3c2c9ad70431d310b0dc118e86fe8ee566c627d2d1ab463c5782d77aebc37221760535b4d106ef6dc41e89b7557ea75f6525e192d87fb828b5f2d5a71fa8812a1cb7b1054c63343ba2552a93c90e34a0fbf9043593359225cf25df1f67af76989d1ad70d55ef27ab05d56376dfb903332466be419ecd6eece62d16dc2ae7f2dc8c544af9649bb22b1a857880e7134ba824c5d0d0941a81b218edf82294744cac26720ad0ed49d29b1afaed545b5c7da0c33a9a9ace783eb0808c02c8b64723c26fb93cbfe036611f84433004de3c45f13e211fa59e89e8651a170719d1c73d0a2ecaba2b5d3c9b006d77d01f9f37a45ff61a296ed2db282edbe0a10f8a26bfd9d170e4b34ddff8cf08b62356c668580b757899e9dcfbe4dbfaee0c70a9715d6af105591ae59240ed9fae09eaba4b8813866fecf0e1061ee44a43a4ed49658ab8414c8f32e144a52a7b1e7cbfa15fbf9043f87b42c9be8cd1d4d93a00a11a8620945f9dbfe1f75d2ab8ba8009a8e373590640a1cc09fb03b613ddf619880b9b026e333bb0eea39f3bc644c8e0c6ffa8f083efbf369ea496fdbffbe76bbb7aaf9f563d276efa718c416993d7e1ac0b073ff7400d73ed80c2408cc9b3c9b15795c2dcd49581fd39180a606f5c4bcc8ec48b01ef536bf1dd72fe80a69399ac88fbbd01d3af7a9b176a9764bd09a79d41eb3a515ebaa9610393079fbf5ed06d724f37e6cd936d2bd9600c6f0a8588aca88c02061dbb9ab72eeb1809627eb21d8df5c6cf420fa9b6ec0e97d433589669f7a3883a8a980cb0b1f5110f18ddb54f22336c28bafe6f5e7ee2267cbc17c776299a3d04652a984de59eb58b028a25da2549fefa795a51e36f9dece90b5a9e424c42d961b15600ce6d705bdfdada88b056ce0136773d7873ccaba956066320b1610fe67e4833a88baaf3e76c7004db1571112c12b3bf8357f1dc9681a106f7bf8247d8304601b210c820bedcac1d2a8f83fcfe712e03dab18a5107627d1092a054b19e85d57a6707e8fb5be8dd78273afb6897bcdaa17d2a314a2ca1c0436b6e2bb71fc09f4b42561e2bfc92ea188264b117d23712b7b6f23b486c6a477898bb9ca0c4f965cfc17bba797f61f4338689feff81c14562d166439b1a1a0cdf7dfb6543513ac8a86e38a277e6a221a6e1922933b12b7ac7373ce1ad64a0737b68632952c4cbcce5f1cbf458c48ac45ad8fac8ee61f28530f14dc68cb6351bf42e

Decrypt String

IMG_20230111_131431.jpg
IMG_20230111_131437.jpg
IMG_20230111_131443.jpg
IMG_20230111_131449.jpg
IMG_20230111_131455.jpg
IMG_20230111_131541.jpg

To decrypt text:

  1. Open the Serial Terminal because you'll need to paste the ciphertext to it;
  2. Select the "Encryption Algorithms" line in the main menu;
  3. Press either the "A" button or the "Enter" key on the PS/2 keyboard;
  4. Select the line with the name of the encryption algorithm you've used to encrypt the text;
  5. Press either the "A" button or the "Enter" key on the PS/2 keyboard;
  6. Select the "Decrypt String" line;
  7. Press either the "A" button or the "Enter" key on the PS/2 keyboard;
  8. Choose where to print the plaintext;
  9. Press either the "A" button or the "Enter" key on the PS/2 keyboard;
  10. Paste the ciphertext to the Serial Terminal;
  11. Press the "Send" button in the Serial Terminal.


Ciphertext:

d4c57216bdf65992892e91e2651db53d51509c07c7ce90334aa79faa0aa8dc3867ca84498332913f391546c2162fccff7664e29db8a23a49e22dc8b4fe79023bc755f3dc271f532be781b97951ac01539127bbfac028c364426e8500d683f1e4dc05da52f31fc5698016ebdb2d54feb51fc65b2692bb271a79e5714e03715b03950e1b87088d5de280f937ed1c7bbec77dea4e0de869e51a4bc20a2ba114b751614a33c061d4d9d4e46b251caa88a872c8d1a1ab61f432b4f813276d1e31e027e60c90a3abd79cd9266689f24956f822a197948491da7ee5da13c0976bf89b5bd433250679c2e91f4d56c6d11c6f8cd70d878bc6af6cf12fb2a191b3c2f5037e233f3648da89570b76418b9fb6afbc6053bd62c0d741fdb946a279c0cd271cd291ca753343646e610bfbdc8860974b52bb00128e852dc153ea67b50aace4261eef54f9a98eb4c091d725c7d4aed8f136e426723a3c2c9ad70431d310b0dc118e86fe8ee566c627d2d1ab463c5782d77aebc37221760535b4d106ef6dc41e89b7557ea75f6525e192d87fb828b5f2d5a71fa8812a1cb7b1054c63343ba2552a93c90e34a0fbf9043593359225cf25df1f67af76989d1ad70d55ef27ab05d56376dfb903332466be419ecd6eece62d16dc2ae7f2dc8c544af9649bb22b1a857880e7134ba824c5d0d0941a81b218edf82294744cac26720ad0ed49d29b1afaed545b5c7da0c33a9a9ace783eb0808c02c8b64723c26fb93cbfe036611f84433004de3c45f13e211fa59e89e8651a170719d1c73d0a2ecaba2b5d3c9b006d77d01f9f37a45ff61a296ed2db282edbe0a10f8a26bfd9d170e4b34ddff8cf08b62356c668580b757899e9dcfbe4dbfaee0c70a9715d6af105591ae59240ed9fae09eaba4b8813866fecf0e1061ee44a43a4ed49658ab8414c8f32e144a52a7b1e7cbfa15fbf9043f87b42c9be8cd1d4d93a00a11a8620945f9dbfe1f75d2ab8ba8009a8e373590640a1cc09fb03b613ddf619880b9b026e333bb0eea39f3bc644c8e0c6ffa8f083efbf369ea496fdbffbe76bbb7aaf9f563d276efa718c416993d7e1ac0b073ff7400d73ed80c2408cc9b3c9b15795c2dcd49581fd39180a606f5c4bcc8ec48b01ef536bf1dd72fe80a69399ac88fbbd01d3af7a9b176a9764bd09a79d41eb3a515ebaa9610393079fbf5ed06d724f37e6cd936d2bd9600c6f0a8588aca88c02061dbb9ab72eeb1809627eb21d8df5c6cf420fa9b6ec0e97d433589669f7a3883a8a980cb0b1f5110f18ddb54f22336c28bafe6f5e7ee2267cbc17c776299a3d04652a984de59eb58b028a25da2549fefa795a51e36f9dece90b5a9e424c42d961b15600ce6d705bdfdada88b056ce0136773d7873ccaba956066320b1610fe67e4833a88baaf3e76c7004db1571112c12b3bf8357f1dc9681a106f7bf8247d8304601b210c820bedcac1d2a8f83fcfe712e03dab18a5107627d1092a054b19e85d57a6707e8fb5be8dd78273afb6897bcdaa17d2a314a2ca1c0436b6e2bb71fc09f4b42561e2bfc92ea188264b117d23712b7b6f23b486c6a477898bb9ca0c4f965cfc17bba797f61f4338689feff81c14562d166439b1a1a0cdf7dfb6543513ac8a86e38a277e6a221a6e1922933b12b7ac7373ce1ad64a0737b68632952c4cbcce5f1cbf458c48ac45ad8fac8ee61f28530f14dc68cb6351bf42e

Plaintext:

In case you want to know why I called this project Midbar - Midbar is a Hebrew word that means "pasture," "uninhabited land," "wilderness," "large tracts of wilderness (around cities)," "desert." I had two reasons for choosing the word Midbar as the name of this project. First - while working on my previous projects, I noticed that the so called "device that keeps your personal data secure in an encrypted form" market is pretty much a "desert around the oasis of the password manager market." Second - I couldn't find a better word to describe that project. At first, I wanted to call it a "Password Vault," but then I realized that it's more than just a password vault. So, I just called it Midbar!

Hash String

IMG_20230111_130552.jpg
IMG_20230111_130558.jpg
IMG_20230111_130649.jpg
IMG_20230111_130655.jpg

The Midbar utilizes two hash functions: SHA-256 and SHA-512.

If you're not familiar with the hash functions, let me give you a simple explanation of what the hash function is.

The hash function is an algorithm that takes your input (in that case, it's a string) and gives you a fixed-length output derived from that input. One of the essential properties of the hash function is that it always produces the same result for the same input. That allows you to use the hash function to verify the data integrity.


To hash a string:

  1. Select the "Hash Functions" line in the main menu;
  2. Either press the "A" button or press the "Enter" key on the PS/2 keyboard;
  3. Select the "SHA-256" or "SHA-512" line depending on the hash function you'd like to use;
  4. Either press the "A" button or press the "Enter" key on the PS/2 keyboard;
  5. Enter the string you'd like to hash;
  6. Either quad-click the encoder button or press the "Enter" key on the PS/2 keyboard.


Input:

Midbar

Hash:

0415af21a07eb50be9ce02417f73c1d6b8c30631a5a4240b662ff89e3531fcfa02dfe06a808acacf81b523066f81495dc3004e375f08e71943cad0589807b160


Find a Good Use for Midbar

IMG_20230111_132723.jpg
IMG_20230111_132005.jpg

I wouldn't say that this version of Midbar is either (significantly) worse or better than the previous one. I would consider it a branch of Midbar with its own pros and cons.

Although it handles the PS/2 keyboard much better than the previous Midbar and can easily encrypt and decrypt a 10000-character long string without any problems, it has some downsides absent in the Midbar V2.5. It can't execute SQL queries, doesn't have a secure communication channel, and seems to be a bit slower and less stable than the previous Midbar.

But it might turn out that all of these are actually minor issues. Take into account that I'm writing the following based solely on my observations. It seems to me that the Raspberry Pi Pico doesn't have a properly functioning random number generator (or at least I wasn't able to figure out how to work with it). By trying to generate the random values with the "rand()" function, I got a sequence that repeated even after the board was rebooted. I then started googling "how to generate random numbers on Raspberry Pi Pico" and stumbled upon a possible solution. But still, I won't be putting much trust into the Raspberry Pi Pico's RNG.


By the way, let me remind you that the Midbar project isn't there to give you a 100% guarantee for something. It's not about that, and it never was. It's about raising the cost of unauthorized access to your data as high as possible!

And if you want to make your own version of the Midbar or change something in it, please do so! Don't forget that there's always room for improvement, even if it seems that there's none.

That's it for this tutorial.

If you like this tutorial, please share it.

Thank you for reading this tutorial.