Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. def decryption(encryptedString,key_from_file):
  2. PADDING = '{'
  3. DecodeAES = lambda c, e: c.decrypt(base64.b64decode(e)).rstrip(PADDING)
  4. #Key is FROM the printout of 'secret' in encryption
  5. #below is the encryption.
  6. encryption = encryptedString
  7. key = key_from_file
  8. cipher = AES.new(key) #### error comes here
  9. decoded = DecodeAES(cipher, encryption)
  10. return decoded
  11.  
  12. def login():
  13. if request.method == 'GET':
  14. return render_template('login.html')
  15. if request.method == 'POST':
  16. username = request.form['username']
  17. password = request.form['password']
  18. d2 = pandas.read_csv("Employee_Info.txt",header=0)
  19. search_id = d2[d2['email'] == username]
  20. pdb.set_trace()
  21. if search_id.empty:
  22. error = "username does not exists"
  23. return render_template('login.html', error = error)
  24. else:
  25. pwd_from_file=search_id.iloc[0]['pwd']
  26. key_from_file=search_id.iloc[0]['key']
  27.  
  28. if decryption(pwd_from_file,key_from_file) == password:
  29. print "matching password"
  30. else:
  31. print "mismatch"
  32.  
  33. id,email,pwd,key
  34. qq,qq,h4vvEPuVNwjw22yJKz8QGg==,xéðjŸ¸AOݬ‡
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement