How to design and generate user uid?

(the mobile version can"t upload the picture, go back to make it up tonight)

General uid. If the figure above is a string of fixed-length numbers, how is it generated? When storing uid in a database, doesn"t it usually start at 1 and then grow itself? How to implement this fixed-length id? Now I don"t know if I have a way of thinking: in the database, the uid, will grow from 1 to 21, and then there will be different digits of id of 1 and 21. When displaying, will the non-fixed-length uid be encrypted into a fixed-length uid for display through a certain encryption algorithm?


import uuid
uid = uuid.uuid1()

fixed length is easy to do:

  

learn about hashids

Menu