title: cryptography python encryption for creating password error
body: <p>I have a problem in printing the encryption in file for password using cryptography, I want to encrypt the creation of master key and the login key to decrypt and check password</p>
  <pre><code>from cryptography.fernet import Fernet
  
  class hash_password():
      def genewrite_key():
          key= Fernet.generate_key()
          with open(&quot;pass.key&quot;,&quot;wb&quot;) as key_file:
              key_file.write(key)
  
      def get_key():
          key= open(&quot;pass.key&quot;,&quot;rb&quot;).read()
          return key
  
  
  class signIn():
      def create_masterkey(hash):
          hash_password.genewrite_key()
          cr_pass = input(&quot;Create your password so you can access your data in future and please remember it: &quot;)
          hash = cr_pass.encode()
          key= hash_password.get_key()
          a= Fernet(key)
          txt = a.encrypt(hash)
  
          with open('P1ssW0rd.txt', 'a') as f:
              f.write(str(hash) +&quot;\n&quot;)     
          if len(cr_pass)&lt;= 6:
              print(&quot;Password is too short&quot;)
              signIn().create_masterkey()
          else: print(&quot;Passcode Created Successfully!&quot;)
  
      def Login():
          
          hash_password.genewrite_key() 
          key= hash_password.get_key()
          a= Fernet(key)
          login_pass = input(&quot;whats you passcode? &quot;)
          file = open(&quot;P1ssW0rd.txt&quot;)
          decoded_text = a.decrypt(hash)
  
          if(login_pass in file.read()):
              print(&quot;true password&quot;)
          else:
              print(&quot;Creditionals doesn't exist&quot;)
              signIn().create_masterkey()
          file.close()
  </code></pre>