W
W
Wet_Dumplings2018-09-16 19:43:25
Python
Wet_Dumplings, 2018-09-16 19:43:25

How to select characters with position check?

Hello!
There is a database with a label users and fields <login>, <password>. Suppose I take the record [('admin', '123456')]
how to make it so that when entering the login `admin` the "password entry" of the form comes out: (suppose) enter position 1 = [insertNumber(1)], enter position 6 = [[insertNumber(6)] and so that at login each time there is a different number of positions that you need to enter (that is, the user enters the password not entirely, but only certain positions) Otherwise,
I could not find how to pull out a certain field with the required password ( except to bring it out -

"SELECT password FROM users WHERE login=?",(currentLogin,))
) nor how to implement the user verification method described above (because in addition to entering random positions, you obviously need to check them - but again I could not find how to make a text array from the SQL table field)

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
S
Sergey Tikhonov, 2018-09-17
@tumbler

In the twenty-first century, billion dollar corporations leak 200 million accounts every month directly from the database, and we have passwords in the database in clear text.
The only place where the password is checked in this way, I met only in SecureBoot, and this is wildly inconvenient.
But if you are interested in the implementation, I can offer the following:

  1. Save values ​​hashed with salt in the database like Pxxx, xAxx, xxSx, etc.
  2. finish hashes to the maximum length of the password, so as not to burn its length
  3. use a different string instead of xxx for each character position of the original password
  4. when entering the next character, check if the user has the desired hash
  5. do not assume that this way of storing the password is secure

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question