Pin Generation

前端 未结 11 843
走了就别回头了
走了就别回头了 2021-01-31 05:26

I am looking to develop a system in which i need to assign every user a unique pin code for security. The user will only enter this pin code as a means of identifying himself. T

11条回答
  •  旧时难觅i
    2021-01-31 06:13

    4 random digits should be plenty if you append it to unique known userid (could still be number) [as recommended by starblue]

    Pseudo random number generator should also be fine. You can store these in the DB using reversable encryption (AES) or one-way hashing

    The main concern you have is how many times a person can incorrectly input the pin before they are locked out. This should be low, say around three...This will stop people guessing other peoples numbers.

    Any longer than 6 digits and people will be forgetting them, or worse, writing them on a post-it note on their monitor.

    Assuming an account locks with 3 incorrect attempts, then having a 4 digit pin plus a user ID component UserId (999999) + Pin (1234) gives you a 3/10000 chance of someone guessing. Is this acceptable? If not make the pin length 5 and get 3/100000

提交回复
热议问题