Midbar (Raspberry Pi Pico Version) V2.0

by Northstrix in Circuits > Raspberry Pi

2066 Views, 6 Favorites, 0 Comments

Midbar (Raspberry Pi Pico Version) V2.0

IMG_20230324_151103.jpg

As I've mentioned in the previous tutorials, with the development of cryptanalysis and new hacking techniques, the cost of accessing your data without your authorization continues to decline, making it easier and more attractive for different sides to get it.

I'm not going to get into details about the motivation of each side and the goals they're trying to achieve by obtaining your data. Instead, I would like to focus on the solution to that problem.

In my opinion, the only way to keep your data private is to raise the costs of unauthorized access to it as high as possible, ideally higher than any reward that a third side can get by obtaining your data. Doing so puts away the incentives to access your data without your permission.

To raise the cost of unauthorized access to your data - I've developed Midbar (which later on "evolved" into a multi-user Cipherbox, and then it kinda turned back into Midbar because I realized that a "multi-user Midbar" is superfluous and not as stable as a single-user one).

After ending the Cipherbox project and making several versions of Midbar, I realized that although making a "multi-user Midbar" wasn't a good idea, making "a vault that requires the RFID cards to be unlocked" was rather a good idea than a bad one. So, I made a decision to combine what I consider to be the best aspects of Midbar and Cipherbox in the Midbar V4.0 by making a "single-user Midbar that requires four RFID cards to be unlocked." And after that, I decided that I also would like to make a "single-user Midbar that requires four RFID cards to be unlocked that can easily encrypt and decrypt a 10 000 character-long string." So, as you might've already guessed, the Midbar (Raspberry Pi Pico Version) V2.0 is the Raspberry Pi Pico version of the Midbar V4.0.


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!

You can also read this tutorial on Hackster.

Supplies

IMG_20230325_160915.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
  • Mifare RC522 RFID Reader x1
  • RFID cards x4

3DES + AES + Blowfish + Serpent in CBC Mode

FV60PZBLDSTRGLG.png

The "3DES + AES + Blowfish + Serpent" encryption algorithm in cipher block chaining mode first appeared in the Midbar V2.5. And since then has been utilized by the Midbar (Raspberry Pi Pico Version)Midbar V3.0Midbar V4.0, and KhadashPay V2.0.

Although the "3DES + AES + Blowfish + Serpent" encryption algorithm ain't exactly what I would call "a cryptographically weak encryption algorithm," operating it in a weird derivation of the ECB mode, the way it was done by the Midbar V2.0 wasn't the best idea that I had. Even though 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 let's not forget that this encryption algorithm performs the operation called superencryption.

As defined by NIST, superencryption is an encryption operation for which the plaintext input to be transformed is the ciphertext output of a previous encryption operation.

Such organization of the encryption algorithms makes a combined encryption algorithm that is at least as strong as the strongest one in the cascade, has a longer key, might be more resistant to some attacks, and might produce a ciphertext with higher entropy. Anyway. It won't hurt to have an additional layer of security (or several of them).


And by the way, out of all encryption algorithms utilized by the Midbar (Raspberry Pi Pico Version) V2.0, the "3DES + AES + Blowfish + Serpent" is the only algorithm that works in CBC mode. Beware of it!

Integrity Verification

FBRVRAULDSTRGLN.png

The Midbar (Raspberry Pi Pico Version) V2.0 is the sixth 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.

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

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 127 MB archive from GitHub.

Download and Install the Required Libraries

TFT_eSPI: https://github.com/Bodmer/TFT_eSPI

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

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

PS2KeyMap: https://github.com/techpaul/PS2KeyMap

rfid: https://github.com/miguelbalboa/rfid

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 "Sketch" -> "Include Library" -> "Add .ZIP Library..." and then select every archive with the library one after another.

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

Replace the Preset File for the TFT_eSPI Library

FTLCXUCLFFESGF1.png

TFT_eSPI Library requires the preset file to be modified depending on the display and the board that drives the display. Initially, I wanted to write a mini-guide on choosing and renaming the right preset file for the Raspberry Pi Pico. But then I realized that it would be more convenient to attach the ready-to-use preset file to the firmware and tell you where to place it.

So, take the "User_Setup.h" file from the "Raspberry_Pi_Pico_Version\V2.0" folder and place it in the "C:\Program Files (x86)\Arduino\libraries\TFT_eSPI-master" folder.

Install Arduino-pico-littlefs-plugin

F279M5MLCQ8TUKX.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)"

flashpart.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

format.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

gen_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\V2.0\Untested RNG" folder and click the "Gen. keys for Midbar (RPI Pico) V2.0" button. The background turns from dark gray to light gray when you press that button.

Modify the Firmware

modkeys.png

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

Flash Raspberry Pi Pico

flash.png

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

Assemble Midbar

Vault 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 and Tap Four RFID Cards on the RFID Reader

IMG_20230324_153213_hdr.jpg
IMG_20230324_153552_hdr.jpg
IMG_20230324_154128_hdr.jpg
IMG_20230324_154700_hdr.jpg

Just like the Midbar (Raspberry Pi Pico Version), the Midbar (Raspberry Pi Pico Version) V2.0 has four lock screens. Midbar randomly chooses the lock screen at startup.

After the Midbar has chosen the lock screen, it displays the word "מדבר" with the shifting background and the "Tap RFID card N1" inscription.

Tap four RFID cards on the RFID reader one after another. The most important thing here is to tap the cards in the same order every time you unlock Midbar. Otherwise, it just won't unlock.

If you don't have four cards, you can tap one card four times.


*Credit for photos:

London:

Photo by Robert Bye on Unsplash

La Défense:

Photo by Ruben Christen on Unsplash

Dallas:

Photo by Erin Hervey on Unsplash

Minneapolis:

Photo by Steijn Leijzer on Unsplash

Set the Master Password

FJ1B916LCS1AALF.jpg
F0TV546LCS1AALG.jpg
F7C1SAQLCS1AALH.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 RPI's GP0 and GP1 pins.

And by the way, pressing the "Caps Lock," "Num Lock," or "Scroll Lock" buttons makes the keyboard unresponsive until you remove the power from the Raspberry Pi Pico and put it back again.

Add Login

FQAPDDKLCS1AB0M.jpg
F8QBAQYLDU96UEE.jpg
FFDJ5J5LDU96UEF.jpg
FAFEEKBLDU96UEG.jpg
F6IQJETLDU96UF2.jpg
FVZT3BNLDU96UF3.jpg
FKL4BLALDU96UF4.jpg
F89WHPILDU96UF5.jpg

The Raspberry Pi Pico version of Midbar utilizes the 3DES + AES + Blowfish + Serpent encryption algorithm in CBC mode 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

FDWQY6HLCS1ABDU.jpg
FXY2B7NLDU96UFZ.jpg
FAHSEZDLDU96UG0.jpg
FSIH031LDU96UG1.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 either the "Tab" key on the PS/2 keyboard or the encoder button to print the record to the serial terminal.


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

Edit Login

FP7WARMLCS1ABQT.jpg
FGJBCZBLDU96UGZ.jpg
F5ZUUX1LDU96UH4.jpg
F6PA926LDU96UH7.jpg
FWJJA3ZLDU96UI8.jpg
FC4AA9TLDU96UI9.jpg
FTVLNRSLDU96UIA.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

FFBC4RYLCS1ABTD.jpg
FPK67GXLDU96UJD.jpg
FR236VRLDU96UJE.jpg
FXU7Q6DLDU96UJF.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

FPZT52WLCS1B71Y.jpg
FIIDRH8LCS1B73N.jpg
F53V359LCS1B720.jpg
FH225YKLCS1B721.jpg
FWIJ6ZWLCS1B722.jpg

Midbar utilizes seven encryption algorithms. You can use any of them to encrypt your data.

To encrypt string:

  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:

b32eb64a7e79a02f3da1c75bb8e2a8a0df2ec6bcccaa3fcbe9569bde0acf846f10b9363f5e182c784c7f30bbe4cd58b1ac2fb8afe27a1c3cb2c9892e8253a7be3c076529db7c412c90727246e27d6d94a39d51a8a40a557eff9ce643a45f814f28b87058d4756cdd05704de39029c045a1c5a71f53d104d08379a53ba42f7f468bd38bd53998208741fc4a7351044585fb101f09b17972b3ab1d4e8635fb22bc93236ae34b138e248878053f9ed173b6a7c3939a84883fa9cf8edbefbc804feea9d6f74aa2bcfb6f51308a61fd629f65c95d773579d5d12b12c9e1380c0914a0579a0f872d7995e506f7b2c08510ddeb38ff8c90533692908f16cad88b01d19e7053011468a851404a7a1b66b2243780a678c0ea6ca9dad437ff56a6a1869806e332b1254004548bc574245c43f26eee0e7fa2bb7dd70ac4e036811a4820950d81dc43ea0ff86ee14eefec2ce490987530022fd9d592d780d2378894c1680cdb8d6939502acb657353450e84d38657ba512184cdb138192aea2081f91a595e43b1f09dc2592388e019c405d7592aacba953962f8268de1f40fd0c8463c73cc27fd28dbbd5fd8508adfbd9ba7a55b63f5d36fb808533f2e80fbc41d76d6892146a67f63dd8001dea8241947761ff571c21bb050432fcb076389797e3fada3118775abf694485c1f397e34695e955502f66b8ffd0d66fdfbe5d0a68198b80cc17f35f7437d78eeb7343513dd7fa33fef19ecf3dbbc3a97fe0ebd2df5458595dae82334693ba1efc7975a7bf36f8c26848d3a5efb459fb11c02c469fb0c19b47844d4b5c63614af879e383062d637ab4f493236d75cd92d7ef34177cb856583f4440ac1a411c87bf2efe080cc001cba43bb6b66e19a9a064293647e90aff69ef063e1f2d9515255c1136b5bd4346d822ce2523eca643988149817a1e6eb690cee1850c8c921933b1784097ab474767940c6c6a2800f3f8c457c556f60da34f583a181b1791717d3fbe3db74ddff35babdb2f41f0ffaad78c52194114505b45ef794e9ed99266b02da0410fad215edcf5e7f5a1f49bd6eb786e661691d447ea2da46511790687b82dfa9432ed6027988227234e8156ca997ba23a7e95c2172ebd458311a646b24a145d1fc0b1da2ff1188d11d2893f68462bda8593dd26f3550255294ae1ab12f93aa836b44a574999ce6d52facd1db3b47c1d2883fab530786656a699983e3f1b737f02e3be1db0eeb650dc7b11fe067021bcf0206cfaba01ea56eeaebe2c720d196f3e4742ebc97c02a9ae3b3840f99c754cfac7e05384850f8d463093263ac58cb702a8563df9a95fc45cc5b481dac65849c195b4fca77164573deb82957d157b2dfd13437f979298808c14e7c6781466b65ff6158056178105488250ba372932eaa63f1839ba082045dc1b0abfc278fb9c8092daf0653cc57e0caf6666c3a2a47065bc65933751dcb80ca2f3035b75e97ee19b4b607ec80fd42a6b2f86f71382a40664c8e0a5437bf525caa02e16c6bd885beac21443ef0474b02b533b93d566795e05e8820edea4e3c9fb4d549faec1350d6f552da2d0ff0868bf60d64c33a92bfaaa28e5b7bf9bdbe046f88f66df3c88b699ee1069310feafe3996c3b4e8c80b411b2151612ed261cbb88615d31e63f5eb7a8f212ec43383fcca1f9767601afd4385d87724b19be73d9b7e5b9b31c5503968ea5afb59e0e89

Decrypt String

F4TV3UQLCS1B7BB.jpg
FK8YXY3LCS1B79L.jpg
FCOGMXNLCS1B79M.jpg
FJ4YHTLLCS1B79N.jpg
FVUSWR5LCS1B79O.jpg
FMFEKCYLCS1B79P.jpg

To decrypt string:

  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:

b32eb64a7e79a02f3da1c75bb8e2a8a0df2ec6bcccaa3fcbe9569bde0acf846f10b9363f5e182c784c7f30bbe4cd58b1ac2fb8afe27a1c3cb2c9892e8253a7be3c076529db7c412c90727246e27d6d94a39d51a8a40a557eff9ce643a45f814f28b87058d4756cdd05704de39029c045a1c5a71f53d104d08379a53ba42f7f468bd38bd53998208741fc4a7351044585fb101f09b17972b3ab1d4e8635fb22bc93236ae34b138e248878053f9ed173b6a7c3939a84883fa9cf8edbefbc804feea9d6f74aa2bcfb6f51308a61fd629f65c95d773579d5d12b12c9e1380c0914a0579a0f872d7995e506f7b2c08510ddeb38ff8c90533692908f16cad88b01d19e7053011468a851404a7a1b66b2243780a678c0ea6ca9dad437ff56a6a1869806e332b1254004548bc574245c43f26eee0e7fa2bb7dd70ac4e036811a4820950d81dc43ea0ff86ee14eefec2ce490987530022fd9d592d780d2378894c1680cdb8d6939502acb657353450e84d38657ba512184cdb138192aea2081f91a595e43b1f09dc2592388e019c405d7592aacba953962f8268de1f40fd0c8463c73cc27fd28dbbd5fd8508adfbd9ba7a55b63f5d36fb808533f2e80fbc41d76d6892146a67f63dd8001dea8241947761ff571c21bb050432fcb076389797e3fada3118775abf694485c1f397e34695e955502f66b8ffd0d66fdfbe5d0a68198b80cc17f35f7437d78eeb7343513dd7fa33fef19ecf3dbbc3a97fe0ebd2df5458595dae82334693ba1efc7975a7bf36f8c26848d3a5efb459fb11c02c469fb0c19b47844d4b5c63614af879e383062d637ab4f493236d75cd92d7ef34177cb856583f4440ac1a411c87bf2efe080cc001cba43bb6b66e19a9a064293647e90aff69ef063e1f2d9515255c1136b5bd4346d822ce2523eca643988149817a1e6eb690cee1850c8c921933b1784097ab474767940c6c6a2800f3f8c457c556f60da34f583a181b1791717d3fbe3db74ddff35babdb2f41f0ffaad78c52194114505b45ef794e9ed99266b02da0410fad215edcf5e7f5a1f49bd6eb786e661691d447ea2da46511790687b82dfa9432ed6027988227234e8156ca997ba23a7e95c2172ebd458311a646b24a145d1fc0b1da2ff1188d11d2893f68462bda8593dd26f3550255294ae1ab12f93aa836b44a574999ce6d52facd1db3b47c1d2883fab530786656a699983e3f1b737f02e3be1db0eeb650dc7b11fe067021bcf0206cfaba01ea56eeaebe2c720d196f3e4742ebc97c02a9ae3b3840f99c754cfac7e05384850f8d463093263ac58cb702a8563df9a95fc45cc5b481dac65849c195b4fca77164573deb82957d157b2dfd13437f979298808c14e7c6781466b65ff6158056178105488250ba372932eaa63f1839ba082045dc1b0abfc278fb9c8092daf0653cc57e0caf6666c3a2a47065bc65933751dcb80ca2f3035b75e97ee19b4b607ec80fd42a6b2f86f71382a40664c8e0a5437bf525caa02e16c6bd885beac21443ef0474b02b533b93d566795e05e8820edea4e3c9fb4d549faec1350d6f552da2d0ff0868bf60d64c33a92bfaaa28e5b7bf9bdbe046f88f66df3c88b699ee1069310feafe3996c3b4e8c80b411b2151612ed261cbb88615d31e63f5eb7a8f212ec43383fcca1f9767601afd4385d87724b19be73d9b7e5b9b31c5503968ea5afb59e0e89

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

FW5J3RNLCS1B7FG.jpg
F097S0FLCS1B7FH.jpg
FCN9VZQLCS1B7FI.jpg
F2VAY0QLCS1B7FJ.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


*As you might've noticed, I've reused some photos from the tutorials for Midbar (Raspberry Pi Pico Version) and Midbar V4.0 because the GUI is basically the same - the only thing that changed is the position of the inscription informing you about the integrity of the record. It used to be centered, but now it's aligned to the left.

Find a Good Use for Midbar

F0V1OQOLDVOL84I.jpg
FA4VATLLDVOL84J.jpg

Let's start with the upsides: that version of Midbar can easily encrypt and then decrypt a 10 000 character-long string without any problems, and it's a bit more stable than the Midbar V4.0 because it doesn't have that annoying bag when it reboots if you move between slots too fast using the PS/2 keyboard.

Unfortunately, more stable doesn't mean faster. The Midbar (Raspberry Pi Pico Version) V2.0 is a bit slower than the Midbar V4.0. But even that might turn out to be just a minor issue. 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. Ok, that's it for this tutorial.

If you like this tutorial, please share it.

Thank you for reading this tutorial.