safe enough 8-character short unique random string

前端 未结 7 1360
甜味超标
甜味超标 2021-02-01 01:34

I am trying to compute 8-character short unique random filenames for, let\'s say, thousands of files without probable name collision. Is this method safe enough?



        
7条回答
  •  悲&欢浪女
    2021-02-01 02:23

    From Python 3.6 you should probably use the secrets module. secrets.token_urlsafe() seems to work for your case just fine, and it is guaranteed to use cryptographically safe random sources.

提交回复
热议问题