-/* Set or reset password for puzzle */
-void set_puzzle_password (Puzzle *p, const char *password)
+
+/* verify master password */
+bool verify_master_password (Puzzle *p, const char* password)
+{
+ /* no password set */
+ if (strcmp (p->hashed_master_password, "\0") == 0)
+ return true;
+
+ /* hash the user input password and compare it with the stored password */
+ unsigned char* hashed_mas_password;
+ unsigned int len;
+ digest_message ((const unsigned char *)password, strlen(password),
+ &hashed_mas_password, &len);
+ char hashed_hex_pwd[256] = { (char) NULL };
+ to_hexadecimal (hashed_hex_pwd, hashed_mas_password, len);
+
+ if (strcmp (p->hashed_master_password, hashed_hex_pwd) == 0)
+ return true;
+
+ return false;
+}
+
+/* Set or reset solution password for puzzle */
+void set_solution_password (Puzzle *p, const char *password)