-
Notifications
You must be signed in to change notification settings - Fork 5
RiddleScanner
In this lesson we will be using a barcode scanner to get riddles from QR codes. Then, we will use a substitution cipher to decrypt the text containing the riddles.
Note: You will need to install this android barcode scanner app before starting this project. Most of you should already have it on your phones. (https://play.google.com/store/apps/details?id=com.google.zxing.client.android&hl=en)
Add these block components to your code to use the phone's barcode scanner. Note that you will need a barcode scanner installed for this to work.
We will need the following components
- TableLayout(5 columns, 2 rows),
- 10 TextBox in the TableLayout (width=20% each)
- 2 Buttons
- 4 Labels (For Decrypted_Message, and Encrypted_Message: height=20%)
- BarcodeScanner
Note: TextBoxes BeforeX-AfterX should be arranged like this in the TableLayout
Before1 Before2 Before3 Before4 Before5
After1 After2 After3 After4 After5
- Initialize a variable called message to " ".
- Call the BarcodeScanner's DoScan
When the BarcodeScanner's AfterScan occurs:
- Set the Encrypted_Message to the result of the scan.
- Set the variable message to the result of the scan.
After scanning a qr code, you should see the Encrypted message from the scan appear.
When you click the DecryptButton:
- Set the variable message to the substituted result of the Before and After textboxes, and the message variable.
- Do this 5 times, for every pair of the substitution boxes.
- Set the Decrypted_Message text to the variable message.
Use this key and QR code to test the app.
====Substitution Cipher Key====
7 = i
4 = o
1 = a
8 = w
3 = m
====Encrypted====
7’3 t1ll 8hen 7’3 y4ung 1nd 7’3 sh4rt 8hen 7’3 4ld. 8h1t 13 7?
====Decrypted====
I’m tall when I’m young and I’m short when I’m old. What am I?
- When the barcode scan finishes have the app speak the encrypted riddle to you.
- When a decryption of the riddle is complete, have the app speak the decrypted riddle to you.