def start(): print() print('********************************') print("Student Name - Aniket") print("Title - Micro Project") print("Project Name - Password Hashing") print("Language - Python") print('********************************') print() class Hash: def __init__(self, secret_key): self.secret_key = secret_key def hash(self, password): hashed_password = "" for char in password: hashed_password += chr(ord(char) + self.secret_key) return hashed_password def decrypt(self, hashed_password): decrypted_password = "" for char in hashed_password: decrypted_password += chr(ord(char) - self.secret_key) return decrypted_password start() while True: obj = Hash(1) print("----------------------------------") password = input("Enter Your Password : ") print("----------------------------------") print("Your entered Password : ", password) print("----------------------------------") hashed_password = obj.hash(password) print("Your Hashed password:", hashed_password) print("----------------------------------") decrypted_password = obj.decrypt(hashed_password) print("Your Decrypted password:", decrypted_password) print("----------------------------------") ans = input("Do You want to Continue (Y/N) :") if ans.lower() != 'y': print('.....Thank You.....') break
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter