Skip to content

Commit

Permalink
Merge pull request #258 from AbuBakkar32/Abu-Bakkar
Browse files Browse the repository at this point in the history
pin verification algorithm
  • Loading branch information
AbuBakkar32 authored Nov 27, 2024
2 parents 032abf1 + 1b0d93c commit af68493
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions Algorithm/pin_verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
key = Fernet.generate_key()
cipher_suite = Fernet(key)

print(key)
print(cipher_suite)


def encrypt_pin(pin):
"""Encrypt the PIN using the symmetric key."""
Expand All @@ -31,16 +28,16 @@ def verify_pin(stored_encrypted_pin, input_pin):


# Example usage
# if __name__ == "__main__":
# # Simulate setting up an account with a PIN
# original_pin = "1234" # Example PIN (ideally chosen by the user)
# encrypted_pin = encrypt_pin(original_pin)
# print("Encrypted PIN stored:", encrypted_pin)
#
# # Simulate user attempting to log in
# user_input = input("Enter your PIN: ")
#
# if verify_pin(encrypted_pin, user_input):
# print("PIN verified successfully!")
# else:
# print("Invalid PIN.")
if __name__ == "__main__":
# Simulate setting up an account with a PIN
original_pin = "1234" # Example PIN (ideally chosen by the user)
encrypted_pin = encrypt_pin(original_pin)
print("Encrypted PIN stored:", encrypted_pin)

# Simulate user attempting to log in
user_input = input("Enter your PIN: ")

if verify_pin(encrypted_pin, user_input):
print("PIN verified successfully!")
else:
print("Invalid PIN.")

0 comments on commit af68493

Please sign in to comment.