/OneTimePasswordGenerator

Cybersecurity Foundation Project

Primary LanguagePython

Cybersecurity Foundations

Project 1 - Python Scripting

This was a learning challenge:

  1. Learn Python within 2 weeks
  2. Develop the 2 programs

Program 1: Password Guessing Tool

Write a Python script that prompts the user to enter a guessed password value and responds back by confirming if the provided password matches the one in the system or not.

Use crypt.crypt(word, salt) to perform this validation.


N.B. I had 2 different perspectives on how to approach this script. So I created 2 programs to explore both options:

program1_pgt.py adheres to Lecturer's requirement, where the program should detect the identity (username) of the user logged in and accept a guess attempt and return a result.

program1_pgt1.py allows user to enter a username that may have logged into the current machine recently and accept a guess password.


Program 2: One-Time Password Generator

Implement a One-Time Password generator using the following algorithm.

Hash Feedback One-Time Password Algorithm described in the following chart.

Secret key is used as the initialization vector. The first OTP is generated by hashing this vector.

The second OTP is generated by hashing the hash generated by the first the 1st OTP, and so on.

The OTP is calculated by truncating the hash into a six digit hexadecimal value.

The most significant hex digits will be extracted as the OTP.

Use the following hexadecimal value for the Key: 810770FF00FF07012.

Use hashlib.sha256(input_message).hexdigest() to calculate the hash digest.

Write a Python script that will generate a display on the screen the first 100 OTPs generated by the above algorithm.


With God's guidance and determination to succeed, I completed the challenge on time.

My curiosity begun to grow as I learn more about coding with Python and I begun exploring other options for achieving the same request.