# ____ _ ____ _ _ # / ___|(_) ___ _ __ _ __ __ _ / ___| ___ ___ _ _ _ __(_) |_ _ _ # \___ \| |/ _ \ '__| '__/ _` | \___ \ / _ \/ __| | | | '__| | __| | | | # ___) | | __/ | | | | (_| | ___) | __/ (__| |_| | | | | |_| |_| | # |____/|_|\___|_| |_| \__,_| |____/ \___|\___|\__,_|_| |_|\__|\__, | P7MJ # Combination V. A-1 |___/ 20260128 # Required imports: import datetime, hashlib, uuid, sys # To use, call sierra(). If verification is successful, user will be able to proceed, if not the entire program will terminate. sierra_verification_chances = 3 def sierra_get_key(): # Get a key while True: try: key = int(input("Enter a key (0-999) > ")) if 0 <= key <= 999: return f"{key:03d}" # Format as 3-digit with leading zeros else: print("Key must be between 0 and 999. Please try again.") except ValueError: print("Invalid input. Enter a number between 0 and 999.") def sierra_create_time_code(): # Get the 12-digit time code now = datetime.datetime.now() minutes = (now.minute // 15) * 15 # Quarter Hours rounded_time = now.replace(minute=minutes, second=0, microsecond=0) return rounded_time.strftime("%Y%m%d%H%M") #YYYYMMDDHHMM def sierra_create_key(key, time_code): # Combine key and time code combined = f"{key}{time_code}" hash_obj = hashlib.sha256(combined.encode()) hash_hex = hash_obj.hexdigest() namespace = uuid.NAMESPACE_DNS name = combined.encode() deterministic_uuid = uuid.uuid5(namespace, combined) return str(deterministic_uuid) def sierra_verify(): global sierra_verification_chances key = sierra_get_key() time_code = sierra_create_time_code() correct_uuid = sierra_create_key(key, time_code) user_uuid = input("Enter UUID > ").strip() # Compare if user_uuid == correct_uuid: print("Verification Successful.") return True else: sierra_verification_chances -= 1 print(f"Verification Failed. {sierra_verification_chances} chances left.") def sierra_create_uuid(): key = sierra_get_key() time_code = sierra_create_time_code() generated_uuid = sierra_create_key(key, time_code) print(f""" Generated Key and UUID: Key: {key} UUID: {generated_uuid} """) def sierra(): global sierra_verification_chances print("=" * 80) print("Sierra Security Combination Version A-1") print("-" * 80) try: while True and sierra_verification_chances > 0: print("""Select a mode: [1] Generate a UUID [2] Verify a UUID [3] Exit """) choice = input("Enter your choice > ").strip() if choice == "1": sierra_create_uuid() elif choice == "2": verification_result = sierra_verify() if verification_result: break elif choice == "3": print("Exiting.") sys.exit(0) else: print("Error: Invalid choice.") sys.exit(0) except KeyboardInterrupt: print("\nUser Terminated (Ctrl + C.)") if __name__ == "__main__": sierra() # ==========================================================================================================