Python Forum
best way to embed passwords into scripts
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
best way to embed passwords into scripts
#2
Don't know for Python, but PHP has password_hash($password, PASSWORD_DEFAULT) for saving the password of a new user, as yet unregistered user, to a database table.
This creates a 255 character string, I believe. Anyway, the encrypted password is very long and complicated.

Quote://encrypt password using password_hash()
$password = password_hash($password, PASSWORD_DEFAULT);
//insert new user to our database

Then, when a user logs on, you get the user's ordinary password, like: John, and use password_verify() to check it against the encrypted password stored in the database.

Quote:// first check the password. If incorrect, bale out
//validate the password with $user[password]
if(!password_verify($password, $user['password'])){
$_SESSION['loginerror'] = '密码不对的 Incorrect password!!';
header('location: index.php');
exit();
}

Python must have a very similar system. Except you are not working with webpages and SQL, which should make things easier.
Reply


Messages In This Thread
RE: best way to embed passwords into scripts - by Pedroski55 - Aug-30-2022, 11:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Embed Matplotlib Graph to Tkinter? dimidgen 0 309 Mar-04-2024, 07:40 PM
Last Post: dimidgen
  Interactive plots that can be embed in web page mouse9095 1 671 Jun-12-2023, 04:51 PM
Last Post: deanhystad
  embed python script in C programm gucio321 0 653 Feb-11-2023, 10:47 AM
Last Post: gucio321
  Encrypting Oracle Passwords / Python Library for That? bmccollum 1 2,669 Jun-11-2021, 07:59 PM
Last Post: Larz60+
  Help with passwords program Vasilis 1 1,656 Jan-06-2021, 10:55 AM
Last Post: Larz60+
  Embed Python blender code flaviu2 0 1,545 Nov-16-2020, 06:33 PM
Last Post: flaviu2
  I need help using Python to generate usernames and passwords with excel documents Jannejannesson 3 4,092 May-08-2019, 02:30 PM
Last Post: Jannejannesson
  How to embed mp3 file with Pyinstaller panoss 2 6,029 Apr-01-2019, 01:13 PM
Last Post: yleongtyl
  encrypting PyPi passwords in pypirc dale2k9 1 2,538 Jan-11-2019, 12:38 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020