Writing a console application in Quorum to generate hash values is simple. You can do it for yourself if you want.
If you remember, on the very first day of camp we created a Quorum console application and wrote the famous program Hello World in it.
Here are the instructions for creating a new Console app in Quorum:
Select File from the main menu (alt+f) and then New Project (ctrl+n). This will open up the "New Project Dialog."
Make sure the General tab is selected in the dialog and select the Console option.
In the Project Name text box enter a name like GenerateHash for this project.
Select the OK button at the bottom-right of the dialog.
Now you need to open the Main.quorum file for your new Console.
Select the left-hand tool palette by click it or pressing ctrl+1. Make sure the Projects tab is selected.
Expand the tree your new project. Inside the project you should see a SourceCode folder. Inside the SourceCode folder you should see the Main.quorum file.
Select the Main.quorum file. A blank file will open up in the editor.
Move the focus to the editor by clicking in the editor window or by pressing ctrl+2.
You can paste the following code into the Main.quorum file on your console app. A short description of the code is provided after the code listing.
use Libraries.Network.NetworkExchange
// Set clear text of the value we want to hash.
text clearValue = "1234"
// Hash the clear text value.
NetworkExchange exchange
text hashValue = exchange:HashPassword(clearValue)
output hashValue
Line 1 tells the program that we're going to use the NetworkExchange library. The documentation for that library can be found here.
Lines 2 and 3 create a text variable called clearValue that will be used to store the value we want to hash. On line 3, we have set its value to 1234 so that we can hash the password for our Login app.
Lines 6 through 8 actually hash the value. We use an action in the NetworkExchange library that is specifically designed to hash passwords. On line 8, the value is hashed and stored in a text variable named hashValue.
Line 10 outputs the hashValue so we can see the result. The result will be written to the Console palette.
I'm sure you know how to run Quorum programs by now, but for completeness here are instructions for running and checking the output of your Console app.
Run your program by clicking the green play button in the main toolbar over the editor window or pressing ctrl+r.
The output of the program will be displayed in the Output palette. Navigate to it by click the palette in the bottom of the screen or by pressing ctrl+3.
Make sure the Console tab is selected. You should see the output from your program in the Console window which will contain a hashed value.
The hashed value you see in your app might be different from the one provided in the lab. Why do you think that is?