I was wondering if this would be a secure method of authentication:
theInput = raw_input("Enter password: ")
theHashed = hashlib.sha512(theInput).hexdigest()
if theHashed == "35211b890b19afebfabc3451f04d150f1423bcb54ff7d62095677d7af7560fcvb56c112e879288836cb506853516c5dbd1d779cfaedf4a2f6f6a303600c0c589":
print "Correct!"
If not, what could I do to make it more secure?
Maybe, as long as somebody can’t read or modify your code.
In the case where this is a program run locally on one computer, and the file is installed in such a way that normal users can’t change it, and you know there is no keylogger installed, then maybe it’s okay.
Even if a user can read this file, they can make a copy and modify their copy to remove the authentication step.
Program security is a complex and deep topic that goes beyond mere choice of hashing algorithm.